Open
Description
Compiler version
Minimized example
def f(c: T^, d: T^) =
lazy val x: T^{c} = d; c
val f = () => x
Output
Compiling this with -Xprint:cc
gives:
package <empty> {
@SourceFile("tests/new/test.scala") class T() extends Object() {}
final lazy module val test$package: test$package = new test$package()
@SourceFile("tests/new/test.scala") final module class test$package() extends
Object() {
private[this] type $this = test$package.type
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[test$package.type])
def f(c: T^, d: T^): Unit =
{
lazy val x: T^{c} =
{
d
c
}
val f: () ->{x} (ex$1: caps.Exists) -> T^{x} =
{
def $anonfun(): T^{x} = x
closure($anonfun)
}
()
}
}
}
Expectation
f
should also capture d
, but this is not recorded.
Generally, we have spent no thought so far how to capture check lazy vals, and it looks interesting. Maybe someone wants to pick that up?