Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for polytypes wrapping capturing types #21843

Merged
merged 1 commit into from
Oct 27, 2024

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 24, 2024

A type like

[X] -> A ->{c} B

is currently not allowed since it expands to a PolyType wrapping a CapturingType and we have an implementation restriction that requires PolyTypes to wrap only FunctionTypes. It would be great if we could lift that implementation restriction. Until we do so, we should have a better error message, which this commit implements.

A type like

    [X] -> A ->{c} B

is currently not allowed since it expands to a PolyType wrapping a CapturingType and we
have an implementation restriction that requires PolyTypes to wrap only FunctionTypes. It
would be great if we could lift that implementation restriction. Until we do so, we should
have a better error message, which is commit implements.
Copy link
Contributor

@natsukagami natsukagami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Comment on lines +526 to +528
case None =>
syntaxError(em"Implementation restriction: polymorphic function ${kind}s must have a value parameter", arrowOffset)
errorTree
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add a test for this case too

@odersky odersky merged commit f95d4b2 into scala:main Oct 27, 2024
29 checks passed
@odersky odersky deleted the fix-poly-cc-msg branch October 27, 2024 11:34
@WojciechMazur WojciechMazur added this to the 3.6.3 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants