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

Always enable fewerBraces #15261

Closed
wants to merge 7 commits into from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 22, 2022

This is intended as a test to see what breaks if we made
fewerBraces the standard syntax.

odersky added 6 commits May 20, 2022 18:09
Instead of parsing all formal parameters of a lambda as expressions
and converting to parameters at the end, we now scan ahead the first time
we see a `:` to determine whether the list is followed by `=>` or `?=>`.
If that's the case we parse this parameter and all following ones as
bindings instead of expressions.
Previously the parser accepted `(x: A => B)` as an expression, but
only if there were parentheses around it. This was necessary so that
we could parse a potential formal parameter of a closure `(x: A => B) => ...`
as an expression and then convert to a type. But it is not backed
by the grammar. The grammar requires `x: (A => B)` whether in
parentheses or not.

We now follow the grammar for source versions from 3.2 on.
 - Require a colon in front of a lambda argument
 - Allow lambda arguments on one line
This is intended as a test to see what breaks if we made
fewerBraces the standard syntax.
@odersky odersky force-pushed the fewerbraces-by-default branch from 94c7793 to 0611185 Compare May 22, 2022 13:18
@soronpo
Copy link
Contributor

soronpo commented May 22, 2022

Should I close #14561 ?

@odersky
Copy link
Contributor Author

odersky commented May 23, 2022

@soronpo I think #14561 is orthogonal to these PRs.

@odersky
Copy link
Contributor Author

odersky commented May 23, 2022

I think the PR can be closed now. We have seen that it would work.

@odersky odersky closed this May 23, 2022
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.

2 participants