Skip to content

Better expected type for arguments of overloaded methods #10327

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

Merged
merged 2 commits into from
Nov 17, 2020

Conversation

smarter
Copy link
Member

@smarter smarter commented Nov 15, 2020

pretypeArgs allows arguments of overloaded methods to be typed with a
more precise expected type when the formal parameter types of each overload
are all compatible function types, but previously this logic only kicked
in for arguments which were syntactically known to be functions
themselves, which means that it worked when the argument was foo(_) or
x => foo(x), but not when it was just foo. This commit simply
removes this restriction.

Fixes #10325.

`pretypeArgs` allows arguments of overloaded methods to be typed with a
more precise expected type when the formal parameter types of each overload
are all compatible function types, but previously this logic only kicked
in for arguments which were syntactically known to be functions
themselves, which means that it worked when the argument was `foo(_)` or
`x => foo(x)`, but not when it was just `foo`. This commit simply
removes this restriction.

Fixes scala#10325.
@smarter
Copy link
Member Author

smarter commented Nov 15, 2020

test performance please

@smarter smarter requested a review from odersky November 15, 2020 19:16
@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/10327/ to see the changes.

Benchmarks is based on merging with master (3c04f9b)

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

I just added a small change to clean up a pattern match

@odersky odersky assigned smarter and unassigned odersky Nov 17, 2020
@smarter smarter merged commit ac806b8 into scala:master Nov 17, 2020
@smarter smarter deleted the more-pretyping branch November 17, 2020 14:52
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 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.

Type inference issue with generic method
4 participants