Skip to content

Commit 2c5eb24

Browse files
committed
Fix #18816: Transfer the span of rewired This nodes in fullyParameterizedDef.
1 parent 9453cb1 commit 2c5eb24

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

compiler/src/dotty/tools/dotc/transform/FullParameterization.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ trait FullParameterization {
207207
.subst(origLeadingTypeParamSyms ++ origOtherParamSyms, (trefs ++ argRefs).tpes)
208208
.substThisUnlessStatic(origClass, thisRef.tpe),
209209
treeMap = {
210-
case tree: This if tree.symbol == origClass => thisRef
210+
case tree: This if tree.symbol == origClass => thisRef.withSpan(tree.span)
211211
case tree => rewireTree(tree, Nil) orElse tree
212212
},
213213
oldOwners = origMeth :: Nil,

tests/pos/i18816.scala

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
trait Context
2+
3+
class A(x: Context) extends AnyVal:
4+
given [T]: Context = x
5+
6+
def m1 =
7+
println(m3) // line 11
8+
def m2 =
9+
m3 // line 13
10+
println(m2)
11+
12+
def m3(using Context): String = ""

0 commit comments

Comments
 (0)