File tree 2 files changed +33
-1
lines changed
src/dotty/tools/dotc/transform
test/dotty/tools/backend/jvm
2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ trait FullParameterization {
206
206
.subst(origLeadingTypeParamSyms ++ origOtherParamSyms, (trefs ++ argRefs).tpes)
207
207
.substThisUnlessStatic(origClass, thisRef.tpe),
208
208
treeMap = {
209
- case tree : This if tree.symbol == origClass => thisRef
209
+ case tree : This if tree.symbol == origClass => thisRef.withSpan(tree.span)
210
210
case tree => rewireTree(tree, Nil ) orElse tree
211
211
},
212
212
oldOwners = origMeth :: Nil ,
Original file line number Diff line number Diff line change @@ -1701,6 +1701,38 @@ class DottyBytecodeTests extends DottyBytecodeTest {
1701
1701
1702
1702
}
1703
1703
}
1704
+
1705
+ @ Test def i18816 = {
1706
+ // The primary goal of this test is to check that `LineNumber` have correct numbers
1707
+ val source =
1708
+ """ trait Context
1709
+ |
1710
+ |class A(x: Context) extends AnyVal:
1711
+ | given [T]: Context = x
1712
+ |
1713
+ | def m1 =
1714
+ | println(m3)
1715
+ | def m2 =
1716
+ | m3 // line 9
1717
+ | println(m2)
1718
+ |
1719
+ | def m3(using Context): String = ""
1720
+ """ .stripMargin
1721
+
1722
+ checkBCode(source) { dir =>
1723
+ val clsIn = dir.lookupName(" A$.class" , directory = false ).input
1724
+ val clsNode = loadClassNode(clsIn, skipDebugInfo = false )
1725
+ val method = getMethod(clsNode, " m2$1" )
1726
+ val instructions = instructionsFromMethod(method).filter(_.isInstanceOf [LineNumber ])
1727
+
1728
+ // There used to be references to line 7 here
1729
+ val expected = List (
1730
+ LineNumber (9 , Label (0 )),
1731
+ )
1732
+
1733
+ assertSameCode(instructions, expected)
1734
+ }
1735
+ }
1704
1736
}
1705
1737
1706
1738
object invocationReceiversTestCode {
You can’t perform that action at this time.
0 commit comments