diff --git a/docs/docs/reference/other-new-features/indentation.md b/docs/docs/reference/other-new-features/indentation.md index cc90ca8a1abc..18f00b5407d8 100644 --- a/docs/docs/reference/other-new-features/indentation.md +++ b/docs/docs/reference/other-new-features/indentation.md @@ -74,6 +74,11 @@ There are two rules: - the first token on the next line has an indentation width strictly less than the current indentation width, and + - 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 + ``` - the first token on the next line is not a [leading infix operator](../changed-features/operators.html). diff --git a/tests/neg/i9790.scala b/tests/neg/i9790.scala new file mode 100644 index 000000000000..3417c4b2c7b0 --- /dev/null +++ b/tests/neg/i9790.scala @@ -0,0 +1,7 @@ +object A: + def fn: Unit = + if true then + println(1) + println(2) // error: start of line does not match previous indentation widths + else + println(2) \ No newline at end of file