Don't fail when using Unit class object as a value
#KT-4243 Fixed
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
fun box(): String {
|
||||||
|
Unit
|
||||||
|
|
||||||
|
val a = Unit
|
||||||
|
val b = Unit
|
||||||
|
if (a != b) return "Fail a != b"
|
||||||
|
|
||||||
|
if (Unit != Unit) return "Fail Unit != Unit"
|
||||||
|
|
||||||
|
if (a.VALUE != Unit.VALUE) return "Fail a.VALUE != Unit.VALUE"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -4565,6 +4565,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);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/box/unit"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("unitClassObject.kt")
|
||||||
|
public void testUnitClassObject() throws Exception {
|
||||||
|
doTest("compiler/testData/codegen/box/unit/unitClassObject.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("UnitValue.kt")
|
@TestMetadata("UnitValue.kt")
|
||||||
public void testUnitValue() throws Exception {
|
public void testUnitValue() throws Exception {
|
||||||
doTest("compiler/testData/codegen/box/unit/UnitValue.kt");
|
doTest("compiler/testData/codegen/box/unit/UnitValue.kt");
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
|||||||
public class Unit {
|
public class Unit {
|
||||||
public static final Unit VALUE = new Unit();
|
public static final Unit VALUE = new Unit();
|
||||||
|
|
||||||
|
public static final object object$ = new object();
|
||||||
|
|
||||||
private Unit() {
|
private Unit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,4 +41,9 @@ public class Unit {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return 239;
|
return 239;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class object {
|
||||||
|
private object() {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user