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 normal parameters after given parameters #7317

Merged
merged 3 commits into from
Sep 27, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Sep 25, 2019

With the new given syntax, we can lift the restriction that normal
parameters cannot follow given parameters. This restriction was introduced
because with the previous syntax this looked too awkward.

The added test given-eta shows that eta expansion works as expected for these cases.

With the new given syntax, we can lift the restriction that normal
parameters cannot follow given parameters. This restriction was introduced
because with the previous syntax this looked too awkward.

The added test `given-eta` shows that eta expansion works as expected for these cases.

@main def Test =
given C(1)
val x = f
Copy link
Member

Choose a reason for hiding this comment

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

What happens with eta-expansion if a parameter in the given parameter list depends on a parameter from a previous parameter list ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It usually fails because it can't find the given (unless the same type happens to be implemented by a previous gjven parameter). I added a test.

@milessabin
Copy link
Contributor

🎉 Bravo! 🎉

@smarter smarter merged commit 184f486 into scala:master Sep 27, 2019
@smarter smarter deleted the change-given-eta branch September 27, 2019 20:03
@anatoliykmetyuk anatoliykmetyuk added this to the 0.20 Tech Preview milestone Oct 31, 2019
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.

4 participants