Skip to content

Commit 53b23b2

Browse files
authored
Merge pull request #228 from scala/backport-lts-3.3-22435
Backport "No outdent at eof" to 3.3 LTS
2 parents f9257f6 + 9e05dba commit 53b23b2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

compiler/src/dotty/tools/dotc/parsing/Scanners.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ object Scanners {
615615
if nextWidth < lastWidth then currentRegion = topLevelRegion(nextWidth)
616616
else if !isLeadingInfixOperator(nextWidth) && !statCtdTokens.contains(lastToken) && lastToken != INDENT then
617617
currentRegion match
618+
case _ if token == EOF => // no OUTDENT at EOF
618619
case r: Indented =>
619620
insert(OUTDENT, offset)
620621
handleNewIndentWidth(r.enclosing, ir =>

tests/pos/i22332.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
object Foo:
3+
val foo = 42
4+
// one space
5+

0 commit comments

Comments
 (0)