Open
Description
Compiler version
3.0.0-RC3
Expectation
Constant folding should be able to handle Null
and Unit
.
Possible use cases
class A[T]:
val x: T
object B extends A[Unit]:
val x: Unit = ()
object C extends A[Null]:
val x: Null = ()
def test1 = B.x // should be constant folded to `()`
def test2 = C.x // should be constant folded to `null`
inline val n = null
inline val u = ()
def test1 = n // should be constant folded to `null`
def test2 = u // should be constant folded to `()`