-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Document additional optional braces conditions #12090
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
Comments
I would say it is documented in the syntax http://dotty.epfl.ch/docs/reference/syntax.html: Expr1 ::= ...
| ‘while’ ‘(’ Expr ‘)’ {nl} Expr
BlockExpr ::= <<< (CaseClauses | Block) >>> // BlockExpr <- SimpleExpr <- PrefixExpr <- InfixExpr <- PostfixExpr <- Expr1 <- Expr
<<< ts >>> ::= ‘{’ ts ‘}’
| indent ts outdent
<<< ts >>> ::= [nl] ‘{’ ts ‘}’
| `:` indent ts outdent |
I haven't noticed it there 🤔 and also it's still kind of weird to have the additional I would however add it here for the users: http://dotty.epfl.ch/docs/reference/other-new-features/indentation.html |
Ok, thanks @bishabosha for pointing me to the syntax, I haven't noticed that it's actually included there. I thought that the optional braces page was better to look at. It seems we don't have anything else besides these 3 I mentioned. |
Good point. The optional braces after |
I think that we decided that This works in if (true)
println(1)
println(2) We can add scalafix rules for all the syntax changes by then, so in most cases this should be straightforward to migrate. |
Ah, yes, you are right of course. I got my versions crossed. So yes, everything behaves in the same way and we are good. |
I actually don't see a discussion of indentation after |
Sure! That makes sense. |
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.0.0-RC2
Minimized code
The below examples work with optional braces, but are undocumented, which caused us to skip it while implementing the parser:
Are we missing anything?
Expectation
We should have optional braces properly documented, otherwise it's hard to build tooling around it, but also it might cause suprises to the users.
The text was updated successfully, but these errors were encountered: