-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Improve parameter type inference error messaging #18190
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
Conversation
@@ -1,14 +1,18 @@ | |||
-- [E081] Type Error: tests/neg/i17183.scala:11:24 --------------------------------------------------------------------- | |||
11 |def test = Context(f = (_, _) => ???) // error // error | |||
| ^ | |||
| Missing parameter type | |||
| Could not infer type for parameter _$1 of anonymous function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be possible to report
Could not infer type for the 1st parameter of an anonymous function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be possible, but I'm not sure it's desirable, I think here we need to show some internals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal names of _
and other unamed variables are only useful to us. Never to the user as they cannot use them in the source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but we need to show the desugarring anyways, as the issue might be that the user missunderstood how _
works
And therefore need names in the desugarring (but these could be something else than _$1
)
We fixed the issue, as well as hopefully improved the existing error
Done with @sankalpgambhir