diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index 5bedbb06375b..6593d90c4636 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -742,17 +742,22 @@ object Scanners { if (token == INTERPOLATIONID) { nextRawChar() if (ch == '\"') { - nextRawChar() - if (ch == '\"') { + if (lookaheadChar() == '\"') { + nextRawChar() + //offset += 3 // first part is positioned at the quote nextRawChar() stringPart(multiLine = true) } else { + nextChar() token = STRINGLIT strVal = "" } } - else stringPart(multiLine = false) + else { + //offset += 1 // first part is positioned at the quote + stringPart(multiLine = false) + } } else { nextChar() diff --git a/tests/pos/t7919.scala b/tests/pos/t7919.scala new file mode 100644 index 000000000000..220ab9e43002 --- /dev/null +++ b/tests/pos/t7919.scala @@ -0,0 +1,11 @@ + +object X { + val x = s"" + val y = true +} + +/* was: +4 | val y = true + | ^^^ + | end of statement expected but 'val' found +*/