Fix codegen for closures returning 'Unit?'
Only do a checkcast when we need to coerce Object to Unit: the code was hopefully type-checked so that it'll only be necessary when the value is either Unit.VALUE or null
This commit is contained in:
@@ -4868,6 +4868,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/box/unit"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("closureReturnsNullableUnit.kt")
|
||||
public void testClosureReturnsNullableUnit() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/unit/closureReturnsNullableUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3634.kt")
|
||||
public void testKt3634() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/unit/kt3634.kt");
|
||||
@@ -4898,6 +4903,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest("compiler/testData/codegen/box/unit/nullableUnitInWhen2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullableUnitInWhen3.kt")
|
||||
public void testNullableUnitInWhen3() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/unit/nullableUnitInWhen3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unitClassObject.kt")
|
||||
public void testUnitClassObject() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/unit/unitClassObject.kt");
|
||||
|
||||
Reference in New Issue
Block a user