Skip to content

Fix #3252: Change logic in adaptNoArgs #3254

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 3 commits into from
Oct 5, 2017
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 4, 2017

adaptNoArgs would do an implicit argument search only if the result type
conformed to the expected type. #3252 shows that this needs to be revised.

adaptNoArgs would do an implicit argument search only if the result type
conformed to the expected type. scala#3252 shows that this needs to be revised.
Split into more manageable sub-methods
@odersky
Copy link
Contributor Author

odersky commented Oct 4, 2017

test performance please

@dottybot
Copy link
Member

dottybot commented Oct 4, 2017

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

@odersky odersky requested a review from allanrenucci October 4, 2017 19:00
@odersky
Copy link
Contributor Author

odersky commented Oct 4, 2017

To review this it's best to look at the first commit in isolation, which is reasonably small. The rest is just moving code around.

@dottybot
Copy link
Member

dottybot commented Oct 4, 2017

Performance test finished successfully:

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

Benchmarks is based on merging with master (443bdb1)

case wtp: ExprType =>
adaptInterpolated(tree.withType(wtp.resultType), pt)
case wtp: ImplicitMethodType
if constrainResult(wtp, followAlias(pt)) || !functionExpected =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the order of the checks matter here? I see that constrainResult generates new constraints if it returns true.
If the order does not matter, then it should be less expensive to first check !functionExpected.

Copy link
Contributor Author

@odersky odersky Oct 5, 2017

Choose a reason for hiding this comment

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

Good observation. The order does matter, actually. constrainResult strenghtens the constraint if it succeeds so we want to always run it.

Copy link
Contributor

@allanrenucci allanrenucci left a comment

Choose a reason for hiding this comment

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

LGTM

@odersky odersky merged commit 7004d07 into scala:master Oct 5, 2017
@allanrenucci allanrenucci deleted the fix-#3252 branch December 14, 2017 19:18
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