JVM IR: fix "null" as the first entry in MappedEnumWhenLowering
If "null" was the first entry in an optimizable "when" over enum, mapRuntimeEnumEntry was called before mapConstEnumEntry, and the $WhenMappings field was not created. Now both mapConstEnumEntry and mapRuntimeEnumEntry create this field on the first access
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
enum class E {
|
||||
A, B;
|
||||
}
|
||||
|
||||
fun foo(e: E?): String {
|
||||
val c = when (e) {
|
||||
null -> "Fail: null"
|
||||
E.B -> "OK"
|
||||
E.A -> "Fail: A"
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
fun box(): String = foo(E.B)
|
||||
Reference in New Issue
Block a user