-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #2998: Constrain type from above before interpolating variables #3774
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
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/3774/ to see the changes. Benchmarks is based on merging with master (7e402a7) |
When interpolating type variables we should use all available information at this point, including the expected result type. One situation where this makes a difference is if the expected type is a singleton type, because type variables are instantiated to singleton types only if their upper bounds are singleton types. Also fixes scala#2997.
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/3774/ to see the changes. Benchmarks is based on merging with master (7e402a7) |
Performance tests indicated a 3% slowdown for dotty. Trying to mitigate that by avoiding constraining types multiple times.
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/3774/ to see the changes. Benchmarks is based on merging with master (7e402a7) |
The last commit seemed to have helped performance, so we are good on that count, I think. |
case _ => false | ||
} | ||
|
||
var isConstrained = false |
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 cleaner to do:
var isConstrained = tree.isInstanceOf[Apply] || tree.tpe.isInstanceOf[MethodOrPoly]
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 saw that comment to late, after merging. I'll attach the change to a subsequent PR.
This commit cleans up a piece of code of scala#3774 (which is already merged). It was suggested in review comments.
This commit cleans up a piece of code of scala#3774 (which is already merged). It was suggested in review comments.
This commit cleans up a piece of code of scala#3774 (which is already merged). It was suggested in review comments.
This commit cleans up a piece of code of scala#3774 (which is already merged). It was suggested in a review comments.
When interpolating type variables we should use all available information
at this point, including the expected result type. One situation where this makes
a difference is if the expected type is a singleton type, because type variables
are instantiated to singleton types only if their upper bounds are singleton types.
Also fixes #2997.