Don't treat values of type "Unit?" to be always equal to Unit.VALUE
Two changes here: StackValue.Constant does cast iff value is non-null (if null, no cast between classes is really needed, as null can be an instance of anything), and codegen for safe qualified expressions uses correct type for the expression #KT-4265 Fixed
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
fun <T : Any, R> T.let(f: (T) -> R): R = f(this)
|
||||
|
||||
fun box(): String {
|
||||
val o: String? = null
|
||||
|
||||
var state = 0
|
||||
|
||||
o?.let {
|
||||
state = 1
|
||||
} ?: ({ state = 2 })()
|
||||
|
||||
if (state != 2) return "Fail: $state"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user