Skip to content

Change order of evaluation for default parameters #11609

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 4 commits into from
Mar 5, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 5, 2021

Change order of evaluation for default parameters

Explicitly given parameters are always evaluated before default parameters.
Aligns with spec and Scala 2.

Fixes #11571

odersky added 2 commits March 5, 2021 10:01
It calls `applyOverloaded`, but the interaction of named and default parameters means
that sometimes arguments have to be lifted out and a block is returned instead of an apply.
Explicitly given parameters are always evaluated before default parameters.
Aligns with spec and Scala 2.
Avoid reordering arguments if all explicitly given arguments are pure.
In that case they can be freely interspersed with default getters.
@odersky odersky changed the title Make overloaded in Quotes return a Term instead of an apply. Change order of evaluation for default parameters Mar 5, 2021
@odersky odersky requested a review from nicolasstucki March 5, 2021 13:42
@nicolasstucki nicolasstucki merged commit 80e1920 into scala:master Mar 5, 2021
@nicolasstucki nicolasstucki deleted the fix-11571 branch March 5, 2021 22:03
@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.

Evaluation order of default/named args changed
3 participants