Skip to content

Commit 91783bf

Browse files
committed
Fix line-ending empty interpolation
Forward port fix from 2.11.
1 parent 25cdd9e commit 91783bf

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,12 +742,13 @@ object Scanners {
742742
if (token == INTERPOLATIONID) {
743743
nextRawChar()
744744
if (ch == '\"') {
745-
nextRawChar()
746-
if (ch == '\"') {
745+
if (lookaheadChar() == '\"') {
746+
nextRawChar()
747747
nextRawChar()
748748
stringPart(multiLine = true)
749749
}
750750
else {
751+
nextChar()
751752
token = STRINGLIT
752753
strVal = ""
753754
}

tests/pos/t7919.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
object X {
3+
val x = s""
4+
val y = true
5+
}
6+
7+
/* was:
8+
4 | val y = true
9+
| ^^^
10+
| end of statement expected but 'val' found
11+
*/

0 commit comments

Comments
 (0)