From de37f73c8d1d729e4000ed9704d6f62bde21a594 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 23 Jan 2013 21:03:56 +0400 Subject: [PATCH] Remove tests on RTTI It was never implemented --- .../jet/compiler/android/SpecialFiles.java | 6 - .../codegen/classes/classObjectMethod.kt | 13 - .../codegen/functions/withtypeparams.kt | 10 - .../testData/codegen/regressions/kt1113.kt | 7 - .../testData/codegen/regressions/kt259.kt | 250 ------------------ .../testData/codegen/typeInfo/asInLoop.kt | 5 +- .../codegen/typeInfo/asSafeWithGenerics.kt | 8 - .../codegen/typeInfo/classObjectInTypeInfo.kt | 7 - .../codegen/typeInfo/forwardTypeParameter.kt | 12 - .../codegen/typeInfo/genericFunction.kt | 10 - .../testData/codegen/typeInfo/getTypeInfo.kt | 4 - compiler/testData/codegen/typeInfo/inner.kt | 14 - .../codegen/typeInfo/isTypeParameter.kt | 13 - .../typeInfo/isWithGenericParameters.kt | 8 - .../codegen/typeInfo/isWithGenerics.kt | 7 - .../testData/codegen/typeInfo/nullability.kt | 13 - .../codegen/typeInfo/oneArgTypeinfo.kt | 7 - .../jetbrains/jet/codegen/ClassGenTest.java | 8 - .../jetbrains/jet/codegen/TypeInfoTest.java | 89 +------ 19 files changed, 10 insertions(+), 481 deletions(-) delete mode 100644 compiler/testData/codegen/classes/classObjectMethod.kt delete mode 100644 compiler/testData/codegen/functions/withtypeparams.kt delete mode 100644 compiler/testData/codegen/regressions/kt1113.kt delete mode 100644 compiler/testData/codegen/regressions/kt259.kt delete mode 100644 compiler/testData/codegen/typeInfo/asSafeWithGenerics.kt delete mode 100644 compiler/testData/codegen/typeInfo/classObjectInTypeInfo.kt delete mode 100644 compiler/testData/codegen/typeInfo/forwardTypeParameter.kt delete mode 100644 compiler/testData/codegen/typeInfo/genericFunction.kt delete mode 100644 compiler/testData/codegen/typeInfo/getTypeInfo.kt delete mode 100644 compiler/testData/codegen/typeInfo/inner.kt delete mode 100644 compiler/testData/codegen/typeInfo/isTypeParameter.kt delete mode 100644 compiler/testData/codegen/typeInfo/isWithGenericParameters.kt delete mode 100644 compiler/testData/codegen/typeInfo/isWithGenerics.kt delete mode 100644 compiler/testData/codegen/typeInfo/nullability.kt delete mode 100644 compiler/testData/codegen/typeInfo/oneArgTypeinfo.kt diff --git a/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/SpecialFiles.java b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/SpecialFiles.java index a316dbc9fb2..74a72752742 100644 --- a/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/SpecialFiles.java +++ b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/SpecialFiles.java @@ -87,18 +87,12 @@ public class SpecialFiles { excludedFiles.add("namespaceQualifiedMethod.kt"); // Cannot change package name excludedFiles.add("kt1482_2279.kt"); // Cannot change package name excludedFiles.add("kt1482.kt"); // Cannot change package name - excludedFiles.add("withtypeparams.kt"); // Cannot find usages in Codegen tests excludedFiles.add("kt326.kt"); // Commented excludedFiles.add("kt1213.kt"); // Commented excludedFiles.add("kt882.kt"); // Commented excludedFiles.add("kt789.kt"); // Commented excludedFiles.add("enum.kt"); // Commented excludedFiles.add("withclosure.kt"); // Commented - excludedFiles.add("isTypeParameter.kt"); // Commented - excludedFiles.add("nullability.kt"); // Commented - excludedFiles.add("genericFunction.kt"); // Commented - excludedFiles.add("forwardTypeParameter.kt"); // Commented - excludedFiles.add("classObjectMethod.kt"); // Commented excludedFiles.add("inRangeConditionsInWhen.kt"); // Commented excludedFiles.add("kt1592.kt"); // Codegen don't execute blackBoxFile() on it diff --git a/compiler/testData/codegen/classes/classObjectMethod.kt b/compiler/testData/codegen/classes/classObjectMethod.kt deleted file mode 100644 index 19aa6482a5b..00000000000 --- a/compiler/testData/codegen/classes/classObjectMethod.kt +++ /dev/null @@ -1,13 +0,0 @@ -abstract open class Default { - abstract fun defaultValue(): Int -} - -class MyInt() { - class object : Default() { - override fun defaultValue(): Int = 610 - } -} - -fun toDefault(t: T) where class object T: Default = T.defaultValue() - -fun box(): String = if (toDefault(MyInt()) == 610) "OK" else "fail" diff --git a/compiler/testData/codegen/functions/withtypeparams.kt b/compiler/testData/codegen/functions/withtypeparams.kt deleted file mode 100644 index b88aad83cfb..00000000000 --- a/compiler/testData/codegen/functions/withtypeparams.kt +++ /dev/null @@ -1,10 +0,0 @@ -class X () { - fun getTypeChecker() = { (a : Any) -> a is T } -} - -fun box() : String { - val c = X().getTypeChecker() - if(c(10)) return "fail" - if(!c("lala")) return "fail" - return "OK" -} diff --git a/compiler/testData/codegen/regressions/kt1113.kt b/compiler/testData/codegen/regressions/kt1113.kt deleted file mode 100644 index dc75494b435..00000000000 --- a/compiler/testData/codegen/regressions/kt1113.kt +++ /dev/null @@ -1,7 +0,0 @@ -class A - -fun box():String { - System.out?.println(typeinfo("foo" as String?)) - System.out?.println(typeinfo("foo")) - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/regressions/kt259.kt b/compiler/testData/codegen/regressions/kt259.kt deleted file mode 100644 index ad996781b9f..00000000000 --- a/compiler/testData/codegen/regressions/kt259.kt +++ /dev/null @@ -1,250 +0,0 @@ -class A() {} - -open class B() { - fun isT (a : Any?) : Boolean { - return a is T - } -} - -class C() : B() { -} - -class D() : B>() { -} - -fun t1() : Boolean { - val a = A() - if(a !is A) return false - return true -} - -fun t2() : Boolean { - val a = A() - if(a !is A?) return false - return true -} - -fun t3() : Boolean { - val a = A() - if(null !is A?) return false - return true -} - -fun t4 () : Boolean { - val b = B() - if(b !is B) return false - return true -} - -fun t5 () : Boolean { - val b = B() - if(b !is B?) return false - return true -} - -fun t6 () : Boolean { - if(null !is B?) return false - return true -} - -fun t7 () : Boolean { - val b = B() - if(!b.isT("aaa")) return false - return true -} - -fun t8 () : Boolean { - val b = B() - if(b.isT(10)) return false - return true -} - -fun t9 () : Boolean { - val b = B() - if(b.isT(null)) return false - return true -} - -fun t10 () : Boolean { - val d = B() - if(!d.isT("aaa")) return false - return true -} -fun t11 () : Boolean { - val d = B() - if(d.isT(10)) return false - return true -} - -fun t12 () : Boolean { - val d = B() - if(!d.isT(null)) return false - return true -} - -fun t13 () : Boolean { - val f = B() - if(!f.isT("aaa")) return false - return true -} - -fun t14 () : Boolean { - val f = B() - if(f.isT(10)) return false - return true -} - -fun t15 () : Boolean { - val f = B() - if(!f.isT(null)) return false - return true -} - -fun t16 () : Boolean { - val c = B() - if(c.isT("aaa")) return false - return true -} - -fun t17 () : Boolean { - val c = B() - if(!c.isT(10)) return false - return true -} - -fun t18 () : Boolean { - val c = B() - if(c.isT(null)) return false - return true -} - -fun t19 () : Boolean { - val e = B() - if(e.isT("aaa")) return false - return true -} - -fun t20 () : Boolean { - val e = B() - if(!e.isT(10)) return false - return true -} - -fun t21 () : Boolean { - val e = B() - if(!e.isT(null)) return false - return true -} - -fun t22 () : Boolean { - val b = B() - val w : B? = b as B //ok - val x = w as B? //TypeCastException - return true -} - -fun t23 () : Boolean { - val b = B() - val v = b as B //ok - return true -} - -fun t24 () : Boolean { - val b = B() - val u = b as B? //TypeCastException - return true -} - -fun t25 () : Boolean { - val c = C() - if(!c.isT("aaa")) return false - return true -} - -fun t26 () : Boolean { - val d = D() - if(!d.isT(B())) return false - return true -} - -fun box() : String { - if(!t1()) { - return "t1 failed" - } - if(!t2()) { - return "t2 failed" - } - if(!t3()) { - return "t3 failed" - } - if(!t4()) { - return "t4 failed" - } - if(!t5()) { - return "t5 failed" - } - if(!t6()) { - return "t6 failed" - } - if(!t7()) { - return "t7 failed" - } - if(!t8()) { - return "t8 failed" - } - if(!t9()) { - return "t9 failed" - } - if(!t10()) { - return "t10 failed" - } - if(!t11()) { - return "t11 failed" - } - if(!t12()) { - return "t12 failed" - } - if(!t13()) { - return "t13 failed" - } - if(!t14()) { - return "t14 failed" - } - if(!t15()) { - return "t15 failed" - } - if(!t16()) { - return "t16 failed" - } - if(!t17()) { - return "t17 failed" - } - if(!t18()) { - return "t18 failed" - } - if(!t19()) { - return "t19 failed" - } - if(!t20()) { - return "t10 failed" - } - if(!t21()) { - return "t21 failed" - } - if(!t22()) { - return "t22 failed" - } - if(!t23()) { - return "t23 failed" - } - if(!t24()) { - return "t24 failed" - } - if(!t25()) { - return "t25 failed" - } - if(!t26()) { - return "t26 failed" - } - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/typeInfo/asInLoop.kt b/compiler/testData/codegen/typeInfo/asInLoop.kt index fafffeea196..725f5bdcfaf 100644 --- a/compiler/testData/codegen/typeInfo/asInLoop.kt +++ b/compiler/testData/codegen/typeInfo/asInLoop.kt @@ -1,7 +1,10 @@ import java.io.* -fun main(args: Array) { + +fun foo(args: Array) { val reader = BufferedReader(InputStreamReader(System.`in`)) while(true) { val cmd = reader.readLine() as String } } + +fun box() = "OK" diff --git a/compiler/testData/codegen/typeInfo/asSafeWithGenerics.kt b/compiler/testData/codegen/typeInfo/asSafeWithGenerics.kt deleted file mode 100644 index 8eec8607d61..00000000000 --- a/compiler/testData/codegen/typeInfo/asSafeWithGenerics.kt +++ /dev/null @@ -1,8 +0,0 @@ -class Wrapper() { - fun castToSelf(wrapper: Any) : Wrapper? = wrapper as? Wrapper -} - -fun foo() : Wrapper? { - val wrapper = Wrapper() - return wrapper.castToSelf(Wrapper()) -} diff --git a/compiler/testData/codegen/typeInfo/classObjectInTypeInfo.kt b/compiler/testData/codegen/typeInfo/classObjectInTypeInfo.kt deleted file mode 100644 index d44a879cc01..00000000000 --- a/compiler/testData/codegen/typeInfo/classObjectInTypeInfo.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Point() { - class object { - fun foo(): String = "bar" - } -} - -fun foo() = Point() diff --git a/compiler/testData/codegen/typeInfo/forwardTypeParameter.kt b/compiler/testData/codegen/typeInfo/forwardTypeParameter.kt deleted file mode 100644 index 2e78cd3ae9c..00000000000 --- a/compiler/testData/codegen/typeInfo/forwardTypeParameter.kt +++ /dev/null @@ -1,12 +0,0 @@ -class Foo() { } -class Bar() { } - -fun isInstance(obj: Any?) = obj is T - -fun isInstance2(obj: Any?) = isInstance(obj) - -fun box(): String { - if (! isInstance2(Foo())) return "fail 1" - if (isInstance2(Foo())) return "fail 2" - return "OK" -} diff --git a/compiler/testData/codegen/typeInfo/genericFunction.kt b/compiler/testData/codegen/typeInfo/genericFunction.kt deleted file mode 100644 index 0bf37d064fe..00000000000 --- a/compiler/testData/codegen/typeInfo/genericFunction.kt +++ /dev/null @@ -1,10 +0,0 @@ -class Foo() { } -class Bar() { } - -fun isInstance(obj: Any?) = obj is T - -fun box(): String { - if (! isInstance(Foo())) return "fail 1" - if (isInstance(Foo())) return "fail 2" - return "OK" -} diff --git a/compiler/testData/codegen/typeInfo/getTypeInfo.kt b/compiler/testData/codegen/typeInfo/getTypeInfo.kt deleted file mode 100644 index d4779382322..00000000000 --- a/compiler/testData/codegen/typeInfo/getTypeInfo.kt +++ /dev/null @@ -1,4 +0,0 @@ -class Point() { -} - -fun foo() = Point() diff --git a/compiler/testData/codegen/typeInfo/inner.kt b/compiler/testData/codegen/typeInfo/inner.kt deleted file mode 100644 index 0285cf592eb..00000000000 --- a/compiler/testData/codegen/typeInfo/inner.kt +++ /dev/null @@ -1,14 +0,0 @@ -class Box() { - open inner class Inner () { - fun isT(s : Any) = if(s is T) "OK" else "fail" - } - - inner class Inner2() : Inner() { - } - - fun inner() = Inner2() -} - -fun box(): String { - return Box().inner().isT("OK") -} diff --git a/compiler/testData/codegen/typeInfo/isTypeParameter.kt b/compiler/testData/codegen/typeInfo/isTypeParameter.kt deleted file mode 100644 index dc4beebff2e..00000000000 --- a/compiler/testData/codegen/typeInfo/isTypeParameter.kt +++ /dev/null @@ -1,13 +0,0 @@ -class Foo() {} -class Bar() {} - -class InstanceChecker() { - fun check(obj: Any?) = obj is T -} - -fun box(): String { - val checker = InstanceChecker() - if (!checker.check(Foo())) return "fail 1" - if (checker.check(Bar())) return "fail 2" - return "OK" -} diff --git a/compiler/testData/codegen/typeInfo/isWithGenericParameters.kt b/compiler/testData/codegen/typeInfo/isWithGenericParameters.kt deleted file mode 100644 index d40eb6e5540..00000000000 --- a/compiler/testData/codegen/typeInfo/isWithGenericParameters.kt +++ /dev/null @@ -1,8 +0,0 @@ -class Wrapper() { - fun isSameWrapper(wrapper: Any) = wrapper is Wrapper -} - -fun foo() : Boolean { - val wrapper = Wrapper() - return wrapper.isSameWrapper(Wrapper()) -} diff --git a/compiler/testData/codegen/typeInfo/isWithGenerics.kt b/compiler/testData/codegen/typeInfo/isWithGenerics.kt deleted file mode 100644 index 4481ede1b02..00000000000 --- a/compiler/testData/codegen/typeInfo/isWithGenerics.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Wrapper() { -} - -fun foo() : Boolean { - val wrapper = Wrapper() - return wrapper is Wrapper -} diff --git a/compiler/testData/codegen/typeInfo/nullability.kt b/compiler/testData/codegen/typeInfo/nullability.kt deleted file mode 100644 index 5ef65122d2b..00000000000 --- a/compiler/testData/codegen/typeInfo/nullability.kt +++ /dev/null @@ -1,13 +0,0 @@ -class Box(t: T) { - var value = t -} - -fun box(): String { - val nullableBox = Box("") - val notnullBox = Box("") - if (nullableBox is Box) return "fail 1" - if (notnullBox is Box) return "fail 2" - if (nullableBox !is Box) return "fail 3" - if (notnullBox !is Box) return "fail 4" - return "OK" -} diff --git a/compiler/testData/codegen/typeInfo/oneArgTypeinfo.kt b/compiler/testData/codegen/typeInfo/oneArgTypeinfo.kt deleted file mode 100644 index a3d6a3ed5b7..00000000000 --- a/compiler/testData/codegen/typeInfo/oneArgTypeinfo.kt +++ /dev/null @@ -1,7 +0,0 @@ -class Point() { -} - -fun foo() : TypeInfo { - val p = Point(); - return typeinfo(p); -} diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java index b23300f782e..53f7aebc2be 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java @@ -39,7 +39,6 @@ public class ClassGenTest extends CodegenTestCase { final Class aClass = loadClass("SimpleClass", generateClassesInFile()); final Method[] methods = aClass.getDeclaredMethods(); // public int SimpleClass.foo() - // public jet.TypeInfo SimpleClass.getTypeInfo() assertEquals(1, methods.length); } @@ -204,13 +203,6 @@ public class ClassGenTest extends CodegenTestCase { blackBoxFile("classes/classObjectInTrait.kt"); } - /* - public void testClassObjectMethod() { - // todo to be implemented after removal of type info - // blackBoxFile("classes/classObjectMethod.kt"); - } - */ - public void testClassObjectInterface() throws Exception { loadFile("classes/classObjectInterface.kt"); final Method method = generateFunction(); diff --git a/compiler/tests/org/jetbrains/jet/codegen/TypeInfoTest.java b/compiler/tests/org/jetbrains/jet/codegen/TypeInfoTest.java index 9f59500619f..b4b49cddc6f 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/TypeInfoTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/TypeInfoTest.java @@ -55,16 +55,6 @@ public class TypeInfoTest extends CodegenTestCase { assertTrue((Boolean) foo.invoke(null, newRunnable())); } - public void testIsWithGenerics() throws Exception { - // TODO: http://youtrack.jetbrains.net/issue/KT-612 - if (true) return; - - loadFile(); -// System.out.println(generateToText()); - Method foo = generateFunction(); - assertFalse((Boolean) foo.invoke(null)); - } - public void testNotIsOperator() throws Exception { loadText("fun foo(x: Any) = x !is Runnable"); Method foo = generateFunction(); @@ -72,62 +62,14 @@ public class TypeInfoTest extends CodegenTestCase { assertFalse((Boolean) foo.invoke(null, newRunnable())); } - public void testIsWithGenericParameters() throws Exception { -// todo: obsolete with typeinfo removal -// loadFile(); -// Method foo = generateFunction(); -// assertFalse((Boolean) foo.invoke(null)); + public void testAsInLoop() { + blackBoxFile("typeInfo/asInLoop.kt"); } - public void testIsTypeParameter() throws Exception { -// todo: obsolete with typeinfo removal -// blackBoxFile("typeInfo/isTypeParameter.kt"); - } - - public void testAsSafeWithGenerics() throws Exception { -// todo: obsolete with typeinfo removal -// loadFile(); -// Method foo = generateFunction(); -// assertNull(foo.invoke(null)); - } - - public void testAsInLoop() throws Exception { - loadFile(); - generateFunction(); // assert no exception - } - - public void testPrimitiveTypeInfo() throws Exception { + public void testPrimitiveTypeInfo() { blackBoxFile("typeInfo/primitiveTypeInfo.kt"); } - public void testNullability() throws Exception { -// todo: obsolete with typeinfo removal -// blackBoxFile("typeInfo/nullability.kt"); - } - - public void testGenericFunction() throws Exception { -// todo: obsolete with typeinfo removal -// blackBoxFile("typeInfo/genericFunction.kt"); - } - - public void testForwardTypeParameter() throws Exception { -// todo: obsolete with typeinfo removal -// blackBoxFile("typeInfo/forwardTypeParameter.kt"); - } - - public void testClassObjectInTypeInfo() throws Exception { - /* - loadFile(); -// System.out.println(generateToText()); - Method foo = generateFunction(); - JetObject jetObject = (JetObject) foo.invoke(null); - TypeInfo typeInfo = jetObject.getTypeInfo(); - final Object object = typeInfo.getClassObject(); - final Method classObjFoo = object.getClass().getMethod("foo"); - assertNotNull(classObjFoo); - */ - } - private Runnable newRunnable() { return new Runnable() { @Override @@ -136,34 +78,15 @@ public class TypeInfoTest extends CodegenTestCase { }; } - public void testKt259() throws Exception { -// todo: obsolete with typeinfo removal -// blackBoxFile("regressions/kt259.kt"); -// System.out.println(generateToText()); - } - - public void testKt511() throws Exception { + public void testKt511() { blackBoxFile("regressions/kt511.kt"); -// System.out.println(generateToText()); } - public void testInner() throws Exception { - blackBoxFile("typeInfo/inner.kt"); -// System.out.println(generateToText()); - } - - public void testKt2811() throws Exception { + public void testKt2811() { blackBoxFile("typeInfo/kt2811.kt"); } - public void testInheritance() throws Exception { + public void testInheritance() { blackBoxFile("typeInfo/inheritance.kt"); -// System.out.println(generateToText()); - } - - public void testkt1113() throws Exception { -// todo: obsolete with typeinfo removal -// blackBoxFile("regressions/kt1113.kt"); -// System.out.println(generateToText()); } }