Skip to content

Commit 735da57

Browse files
committed
Fix #9790: Update indentation spec to match observed behavior
I added the clause 2. An `<outdent>` is inserted at a line break, if - ... - the last token on the previous line is not one of the following tokens which indicate that the previous statement continues: ``` then else do catch finally yield match ``` I tried to do without the added clause but lots of tests break. To verify, set Tokens.statCtdTokens to BitSet() and observe the breakage.
1 parent 93f24a0 commit 735da57

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/docs/reference/other-new-features/indentation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ There are two rules:
7474

7575
- the first token on the next line has an indentation width strictly less
7676
than the current indentation width, and
77+
- the last token on the previous line is not one of the following tokens
78+
which indicate that the previous statement continues:
79+
```
80+
then else do catch finally yield match
81+
```
7782
- the first token on the next line is not a
7883
[leading infix operator](../changed-features/operators.html).
7984

tests/neg/i9790.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
object A:
2+
def fn: Unit =
3+
if true then
4+
println(1)
5+
println(2) // error: start of line does not match previous indentation widths
6+
else
7+
println(2)

0 commit comments

Comments
 (0)