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:
Alexander Udalov
2019-10-18 16:33:34 +02:00
parent 35d7bb4a26
commit 95be7171bc
7 changed files with 53 additions and 13 deletions
@@ -26192,6 +26192,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/when/enumOptimization/nonConstantEnum.kt");
}
@TestMetadata("nullIsTheFirstEntry.kt")
public void testNullIsTheFirstEntry() throws Exception {
runTest("compiler/testData/codegen/box/when/enumOptimization/nullIsTheFirstEntry.kt");
}
@TestMetadata("nullability.kt")
public void testNullability() throws Exception {
runTest("compiler/testData/codegen/box/when/enumOptimization/nullability.kt");