You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/reference/other-new-features/indentation.md
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Optional Braces
4
4
---
5
5
6
6
As an experimental feature, Scala 3 enforces some rules on indentation and allows
7
-
some occurrences of braces `{...}` to be optional.
7
+
some occurrences of braces `{...}` to be optional.
8
8
It can be turned off with the compiler flag `-noindent`.
9
9
10
10
- First, some badly indented programs are flagged with warnings.
@@ -78,10 +78,11 @@ There are two rules:
78
78
If the indentation width of the token on the next line is still less than the new current indentation width, step (2) repeats. Therefore, several `<outdent>` tokens
79
79
may be inserted in a row.
80
80
81
-
An `<outdent>` is also inserted if the next statement following a statement sequence starting with an `<indent>` closes an indentation region, i.e. is one of `then`, `else`, `do`, `catch`, `finally`, `yield`, `}` or `case`.
81
+
An `<outdent>` is also inserted if the next token following a statement sequence starting with an `<indent>` closes an indentation region, i.e. is one of `then`, `else`, `do`, `catch`, `finally`, `yield`, `}`, `)`, `]` or `case`.
82
82
83
-
It is an error if the indentation width of the token following an `<outdent>` does not
84
-
match the indentation of some previous line in the enclosing indentation region. For instance, the following would be rejected.
83
+
An `<outdent>` is finally inserted in front of a comma that follows a statement sequence starting with an `<indent>` if the indented region is itself enclosed in parentheses
84
+
85
+
It is an error if the indentation width of the token following an `<outdent>` does not match the indentation of some previous line in the enclosing indentation region. For instance, the following would be rejected.
0 commit comments