Closed
Description
scala> def foo = { lazy val bar: Unit = { println("Hello") }; bar }
def foo: Unit
scala> bar
// nothing happen
Given:
class Test {
def foo = {
lazy val bar: Unit = println("Hello")
bar
}
}
After erasure:
class Test() {
def foo(): Unit = {
lazy <accessor> def bar(): scala.runtime.BoxedUnit = {
println("Hello")
scala.runtime.BoxedUnit$#UNIT
}
() // no more call to `bar`
}
}