Skip to content

Commit

Permalink
Fix scala#18816: Transfer the span of rewired This nodes in `fullyP…
Browse files Browse the repository at this point in the history
…arameterizedDef`.
  • Loading branch information
sjrd committed Nov 3, 2023
1 parent 9453cb1 commit 2c5eb24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ trait FullParameterization {
.subst(origLeadingTypeParamSyms ++ origOtherParamSyms, (trefs ++ argRefs).tpes)
.substThisUnlessStatic(origClass, thisRef.tpe),
treeMap = {
case tree: This if tree.symbol == origClass => thisRef
case tree: This if tree.symbol == origClass => thisRef.withSpan(tree.span)
case tree => rewireTree(tree, Nil) orElse tree
},
oldOwners = origMeth :: Nil,
Expand Down
12 changes: 12 additions & 0 deletions tests/pos/i18816.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
trait Context

class A(x: Context) extends AnyVal:
given [T]: Context = x

def m1 =
println(m3) // line 11
def m2 =
m3 // line 13
println(m2)

def m3(using Context): String = ""

0 comments on commit 2c5eb24

Please sign in to comment.