Skip to content

Commit 506a9c4

Browse files
incorporate review
1 parent e55aa85 commit 506a9c4

File tree

4 files changed

+6
-53
lines changed

4 files changed

+6
-53
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ object desugar {
16651665
case t => t
16661666
}
16671667
// This is a deliberate departure from scalac, where StringContext is not rooted (See #4732)
1668-
Apply(Select(Apply(scalaDot(nme.StringContext), strs), id), elems)
1668+
Apply(Select(Apply(scalaDot(nme.StringContext).withSpan(tree.span), strs), id), elems)
16691669
case PostfixOp(t, op) =>
16701670
if ((ctx.mode is Mode.Type) && !isBackquoted(op) && op.name == tpnme.raw.STAR) {
16711671
val seqType = if (ctx.compilationUnit.isJava) defn.ArrayType else defn.SeqType

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,15 +1246,11 @@ object Parsers {
12461246
})
12471247

12481248
var offsetCorrection = if isTripleQuoted then 3 else 1
1249-
def offset = {
1250-
val result = in.offset + offsetCorrection
1251-
offsetCorrection = 0
1252-
result
1253-
}
12541249
while (in.token == STRINGPART)
1255-
nextSegment(offset)
1250+
nextSegment(in.offset + offsetCorrection)
1251+
offsetCorrection = 0
12561252
if (in.token == STRINGLIT)
1257-
segmentBuf += literal(inPattern = inPattern, negOffset = offset, inStringInterpolation = true)
1253+
segmentBuf += literal(inPattern = inPattern, negOffset = in.offset + offsetCorrection, inStringInterpolation = true)
12581254

12591255
InterpolatedString(interpolator, segmentBuf.toList)
12601256
}

compiler/test-resources/repl/i6676

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ scala> xml"
77
| ';' expected, but eof found
88
scala> xml""
99
1 | xml""
10-
| ^
11-
| value xml is not a member of StringContext
10+
| ^^^^^
11+
| value xml is not a member of StringContext
1212
scala> xml"""
1313
1 | xml"""
1414
| ^

compiler/test/dotty/tools/dotc/parsing/PositionTest.scala

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)