Remove tests on RTTI
It was never implemented
This commit is contained in:
committed by
Alexander Udalov
parent
0df71bd696
commit
de37f73c8d
@@ -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
|
||||
|
||||
@@ -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: Any>(t: T) where class object T: Default = T.defaultValue()
|
||||
|
||||
fun box(): String = if (toDefault<MyInt>(MyInt()) == 610) "OK" else "fail"
|
||||
@@ -1,10 +0,0 @@
|
||||
class X<T> () {
|
||||
fun getTypeChecker() = { (a : Any) -> a is T }
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val c = X<String>().getTypeChecker()
|
||||
if(c(10)) return "fail"
|
||||
if(!c("lala")) return "fail"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
class A
|
||||
|
||||
fun box():String {
|
||||
System.out?.println(typeinfo("foo" as String?))
|
||||
System.out?.println(typeinfo("foo"))
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,250 +0,0 @@
|
||||
class A() {}
|
||||
|
||||
open class B<T>() {
|
||||
fun isT (a : Any?) : Boolean {
|
||||
return a is T
|
||||
}
|
||||
}
|
||||
|
||||
class C() : B<String>() {
|
||||
}
|
||||
|
||||
class D<T>() : B<B<T>>() {
|
||||
}
|
||||
|
||||
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<String>()
|
||||
if(b !is B<String>) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t5 () : Boolean {
|
||||
val b = B<String>()
|
||||
if(b !is B<String>?) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t6 () : Boolean {
|
||||
if(null !is B<String>?) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t7 () : Boolean {
|
||||
val b = B<String>()
|
||||
if(!b.isT("aaa")) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t8 () : Boolean {
|
||||
val b = B<String>()
|
||||
if(b.isT(10)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t9 () : Boolean {
|
||||
val b = B<String>()
|
||||
if(b.isT(null)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t10 () : Boolean {
|
||||
val d = B<String?>()
|
||||
if(!d.isT("aaa")) return false
|
||||
return true
|
||||
}
|
||||
fun t11 () : Boolean {
|
||||
val d = B<String?>()
|
||||
if(d.isT(10)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t12 () : Boolean {
|
||||
val d = B<String?>()
|
||||
if(!d.isT(null)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t13 () : Boolean {
|
||||
val f = B<java.lang.String?>()
|
||||
if(!f.isT("aaa")) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t14 () : Boolean {
|
||||
val f = B<java.lang.String?>()
|
||||
if(f.isT(10)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t15 () : Boolean {
|
||||
val f = B<java.lang.String?>()
|
||||
if(!f.isT(null)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t16 () : Boolean {
|
||||
val c = B<Int>()
|
||||
if(c.isT("aaa")) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t17 () : Boolean {
|
||||
val c = B<Int>()
|
||||
if(!c.isT(10)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t18 () : Boolean {
|
||||
val c = B<Int>()
|
||||
if(c.isT(null)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t19 () : Boolean {
|
||||
val e = B<Int?>()
|
||||
if(e.isT("aaa")) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t20 () : Boolean {
|
||||
val e = B<Int?>()
|
||||
if(!e.isT(10)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t21 () : Boolean {
|
||||
val e = B<Int?>()
|
||||
if(!e.isT(null)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t22 () : Boolean {
|
||||
val b = B<String>()
|
||||
val w : B<String>? = b as B<String> //ok
|
||||
val x = w as B<String>? //TypeCastException
|
||||
return true
|
||||
}
|
||||
|
||||
fun t23 () : Boolean {
|
||||
val b = B<String>()
|
||||
val v = b as B<String> //ok
|
||||
return true
|
||||
}
|
||||
|
||||
fun t24 () : Boolean {
|
||||
val b = B<String>()
|
||||
val u = b as B<String>? //TypeCastException
|
||||
return true
|
||||
}
|
||||
|
||||
fun t25 () : Boolean {
|
||||
val c = C()
|
||||
if(!c.isT("aaa")) return false
|
||||
return true
|
||||
}
|
||||
|
||||
fun t26 () : Boolean {
|
||||
val d = D<String>()
|
||||
if(!d.isT(B<String>())) 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"
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
import java.io.*
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
fun foo(args: Array<String>) {
|
||||
val reader = BufferedReader(InputStreamReader(System.`in`))
|
||||
while(true) {
|
||||
val cmd = reader.readLine() as String
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = "OK"
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
class Wrapper<T>() {
|
||||
fun castToSelf(wrapper: Any) : Wrapper<T>? = wrapper as? Wrapper<T>
|
||||
}
|
||||
|
||||
fun foo() : Wrapper<Int>? {
|
||||
val wrapper = Wrapper<Int>()
|
||||
return wrapper.castToSelf(Wrapper<String>())
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
class Point() {
|
||||
class object {
|
||||
fun foo(): String = "bar"
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() = Point()
|
||||
@@ -1,12 +0,0 @@
|
||||
class Foo() { }
|
||||
class Bar() { }
|
||||
|
||||
fun isInstance<T>(obj: Any?) = obj is T
|
||||
|
||||
fun isInstance2<T>(obj: Any?) = isInstance<T>(obj)
|
||||
|
||||
fun box(): String {
|
||||
if (! isInstance2<Foo>(Foo())) return "fail 1"
|
||||
if (isInstance2<Bar>(Foo())) return "fail 2"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
class Foo() { }
|
||||
class Bar() { }
|
||||
|
||||
fun isInstance<T>(obj: Any?) = obj is T
|
||||
|
||||
fun box(): String {
|
||||
if (! isInstance<Foo>(Foo())) return "fail 1"
|
||||
if (isInstance<Bar>(Foo())) return "fail 2"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
class Point() {
|
||||
}
|
||||
|
||||
fun foo() = Point()
|
||||
@@ -1,14 +0,0 @@
|
||||
class Box<T>() {
|
||||
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<String>().inner().isT("OK")
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
class Foo() {}
|
||||
class Bar() {}
|
||||
|
||||
class InstanceChecker<T>() {
|
||||
fun check(obj: Any?) = obj is T
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val checker = InstanceChecker<Foo>()
|
||||
if (!checker.check(Foo())) return "fail 1"
|
||||
if (checker.check(Bar())) return "fail 2"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
class Wrapper<T>() {
|
||||
fun isSameWrapper(wrapper: Any) = wrapper is Wrapper<T>
|
||||
}
|
||||
|
||||
fun foo() : Boolean {
|
||||
val wrapper = Wrapper<Int>()
|
||||
return wrapper.isSameWrapper(Wrapper<String>())
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
class Wrapper<T>() {
|
||||
}
|
||||
|
||||
fun foo() : Boolean {
|
||||
val wrapper = Wrapper<Int>()
|
||||
return wrapper is Wrapper<String>
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
class Box<T>(t: T) {
|
||||
var value = t
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val nullableBox = Box<String?>("")
|
||||
val notnullBox = Box<String>("")
|
||||
if (nullableBox is Box<String>) return "fail 1"
|
||||
if (notnullBox is Box<String?>) return "fail 2"
|
||||
if (nullableBox !is Box<String?>) return "fail 3"
|
||||
if (notnullBox !is Box<String>) return "fail 4"
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
class Point() {
|
||||
}
|
||||
|
||||
fun foo() : TypeInfo<Point> {
|
||||
val p = Point();
|
||||
return typeinfo<Point>(p);
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user