Skip to content

Commit 94b0d90

Browse files
authored
Merge pull request #10331 from dotty-staging/fix-#9790
Fix #9790: Update indentation spec to match observed behavior
2 parents 55c87ca + 735da57 commit 94b0d90

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)