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:
Alexander Udalov
2013-12-11 17:56:10 +04:00
parent 9e5c68a8f9
commit 0576851102
4 changed files with 34 additions and 1 deletions
@@ -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");