diff --git a/idea/testData/codegen/regressions/kt259.jet b/idea/testData/codegen/regressions/kt259.jet new file mode 100644 index 00000000000..d2ca498a3b9 --- /dev/null +++ b/idea/testData/codegen/regressions/kt259.jet @@ -0,0 +1,20 @@ +class A() {} +class B() {} + +fun box() : String { + val a = A() + System.out?.println(a is A) //true + System.out?.println(a is A?) //true + + val b = B() + System.out?.println(b is B) //true + System.out?.println(b is B?) //false !!! + + val v = b as B //ok + val u = b as B? //TypeCastException + + val w : B? = b as B //ok + val x = w as B? //TypeCastException + + return "OK" +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/codegen/TypeInfoTest.java b/idea/tests/org/jetbrains/jet/codegen/TypeInfoTest.java index d440c3abd22..d4843618aa9 100644 --- a/idea/tests/org/jetbrains/jet/codegen/TypeInfoTest.java +++ b/idea/tests/org/jetbrains/jet/codegen/TypeInfoTest.java @@ -128,5 +128,10 @@ public class TypeInfoTest extends CodegenTestCase { } }; } + + public void testKt259() throws Exception { + blackBoxFile("regressions/kt259.jet"); + } + } diff --git a/stdlib/src/jet/typeinfo/TypeInfo.java b/stdlib/src/jet/typeinfo/TypeInfo.java index 56607c87bbf..ec93f487468 100644 --- a/stdlib/src/jet/typeinfo/TypeInfo.java +++ b/stdlib/src/jet/typeinfo/TypeInfo.java @@ -49,7 +49,7 @@ public class TypeInfo implements JetObject { if (!theClass.isAssignableFrom(other.theClass)) { return false; } - if (nullable && !other.nullable) { + if (!nullable && other.nullable) { return false; } if (typeParameters != null) {