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

Allow inferred parameter types always, when eta-expanding #18771

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

dwijnand
Copy link
Member

Rather than drawing an exemption based on fully defined types, report
the right function arity. This leads eta-expansion to leave off the
type, so then the parameter type is inferred. In the test case
pos/i18453 this leads to the type var ?A being instantiated to X, rather
than ?A & ?B being constrained against X & Y, which leads to ?A being
instantiated to X & Y - and then failing to find a Box[X & Y] in scope.

@dwijnand dwijnand linked an issue Oct 27, 2023 that may be closed by this pull request
Rather than drawing an exemption based on fully defined types, report
the right function arity.  This leads eta-expansion to leave off the
type, so then the parameter type is inferred.  In the test case
pos/i18453 this leads to the type var ?A being instantiated to X, rather
than ?A & ?B being constrained against X & Y, which leads to ?A being
instantiated to X & Y - and then failing to find a Box[X & Y] in scope.
@dwijnand dwijnand force-pushed the always-infer-param-types branch from be9cd5e to a196167 Compare October 27, 2023 21:02
@dwijnand dwijnand marked this pull request as ready for review October 28, 2023 09:45
@dwijnand dwijnand requested a review from odersky October 28, 2023 09:45
@odersky
Copy link
Contributor

odersky commented Nov 13, 2023

Seems the previous trick is no longer necessary, so this looks like a nice improvement!

@dwijnand dwijnand merged commit 0dfe593 into scala:main Nov 13, 2023
18 checks passed
@dwijnand dwijnand deleted the always-infer-param-types branch November 13, 2023 21:27
@Kordyjan Kordyjan added this to the 3.4.0 milestone Dec 20, 2023
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.

Wrong type inference from lambda function's parameter
3 participants