Closed
Description
object Test {
def test2: Int = {
var ds: String = null
def s = {
ds = "abs"
ds
}
s.length
}
As expected, LambdaLift lifts out def s
and ads additional argument to it, creating a method def s$1(ds$1: scala.runtime.ObjectRef): String
.
At the end of transformation Ident('s')
reference in body of test2
has a fixed symbol s$1
, but the type remains TermRef(NoPrefix, s)
with a fixed symbol s$1
.
As dotty has Idents that are effectively Selects in scalac, backend needs to figure out which reciever to load based on an Ident('s')
. This information was expected to come from type, but in this case type is wrong(should be TermRef(This(Test2), s)
), and it cannot be recreated from symbol as symbol doesn't indicate an object instance for the method invocation.