File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -682,13 +682,16 @@ object Scanners {
682682 reset()
683683 if atEOL then token = COLONeol
684684
685- // consume => and insert <indent> if applicable
685+ // consume => and insert <indent> if applicable. Used to detect colon arrow: x =>
686686 def observeArrowIndented (): Unit =
687687 if isArrow && indentSyntax then
688688 peekAhead()
689- val atEOL = isAfterLineEnd || token == EOF
689+ val atEOL = isAfterLineEnd
690+ val atEOF = token == EOF
690691 reset()
691- if atEOL then
692+ if atEOF then
693+ token = EOF
694+ else if atEOL then
692695 val nextWidth = indentWidth(next.offset)
693696 val lastWidth = currentRegion.indentWidth
694697 if lastWidth < nextWidth then
Original file line number Diff line number Diff line change @@ -518,6 +518,9 @@ class ReplCompilerTests extends ReplTest:
518518 |""" .stripMargin // outdent, but this test does not exercise the bug
519519 assertEquals(List (" hello, world" ), lines())
520520
521+ @ Test def `i22844b regression colon arrow eol` : Unit = contextually :
522+ assertTrue(ParseResult .isIncomplete(" List(42).map: x =>" ))
523+
521524object ReplCompilerTests :
522525
523526 private val pattern = Pattern .compile(" \\ r[\\ n]?|\\ n" );
You can’t perform that action at this time.
0 commit comments