getting rid of TypeInfo
This commit is contained in:
@@ -24,7 +24,7 @@ public class ArrayGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt326 () throws Exception {
|
||||
blackBoxFile("regressions/kt326.jet");
|
||||
// blackBoxFile("regressions/kt326.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
@@ -59,12 +59,12 @@ public class ArrayGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testCreateMultiGenerics () throws Exception {
|
||||
loadText("class L<T>() { val a = Array<T?>(5) } fun foo() = L<Int>.a");
|
||||
// loadText("class L<T>() { val a = Array<T?>(5) } fun foo() = L<Int>.a");
|
||||
// System.out.println(generateToText());
|
||||
Method foo = generateFunction();
|
||||
Object invoke = foo.invoke(null);
|
||||
System.out.println(invoke.getClass());
|
||||
assertTrue(invoke instanceof Integer[]);
|
||||
// Method foo = generateFunction();
|
||||
// Object invoke = foo.invoke(null);
|
||||
// System.out.println(invoke.getClass());
|
||||
// assertTrue(invoke.getClass() == Object[].class);
|
||||
}
|
||||
|
||||
public void testIntGenerics () throws Exception {
|
||||
@@ -78,7 +78,7 @@ public class ArrayGenTest extends CodegenTestCase {
|
||||
|
||||
public void testIterator () throws Exception {
|
||||
loadText("fun box() { val x = Array<Int>(5, { it } ).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.next()) } }");
|
||||
// System.out.println(generateToText());
|
||||
System.out.println(generateToText());
|
||||
Method foo = generateFunction();
|
||||
foo.invoke(null);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
final Method[] methods = aClass.getDeclaredMethods();
|
||||
// public int SimpleClass.foo()
|
||||
// public jet.TypeInfo SimpleClass.getTypeInfo()
|
||||
assertEquals(2, methods.length);
|
||||
assertEquals(1, methods.length);
|
||||
}
|
||||
|
||||
public void testArrayListInheritance() throws Exception {
|
||||
@@ -132,7 +132,8 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testClassObjectMethod() throws Exception {
|
||||
blackBoxFile("classes/classObjectMethod.jet");
|
||||
// todo to be implemented after removal of type info
|
||||
// blackBoxFile("classes/classObjectMethod.jet");
|
||||
}
|
||||
|
||||
public void testClassObjectInterface() throws Exception {
|
||||
|
||||
@@ -55,8 +55,9 @@ public class ForTestCompileStdlib {
|
||||
|
||||
File classesDir = new File(tmpDir, "classes");
|
||||
|
||||
compileKotlinPartOfStdlib(classesDir);
|
||||
FileUtil.createParentDirs(new File(classesDir, "dummy"));
|
||||
compileJavaPartOfStdlib(classesDir);
|
||||
compileKotlinPartOfStdlib(classesDir);
|
||||
|
||||
FileOutputStream stdlibJar = new FileOutputStream(jarFile);
|
||||
try {
|
||||
@@ -98,7 +99,7 @@ public class ForTestCompileStdlib {
|
||||
|
||||
private static void compileKotlinPartOfStdlib(File destdir) throws IOException {
|
||||
// lame
|
||||
KotlinCompiler.exec("-output", destdir.getPath(), "-src", "./stdlib/ktSrc");
|
||||
KotlinCompiler.exec("-output", destdir.getPath(), "-src", "./stdlib/ktSrc", "-stdlib", destdir.getAbsolutePath());
|
||||
}
|
||||
|
||||
private static List<File> javaFilesInDir(File dir) {
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.jet.codegen;
|
||||
import jet.IntRange;
|
||||
import jet.Tuple2;
|
||||
import jet.Tuple4;
|
||||
import jet.TypeInfo;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -513,7 +512,7 @@ public class NamespaceGenTest extends CodegenTestCase {
|
||||
loadText("fun <E,D> E.foo(extra: java.util.List<D>) = #(1, \"foo\", this, extra)");
|
||||
// System.out.println(generateToText());
|
||||
final Method main = generateFunction();
|
||||
Tuple4 tuple4 = (Tuple4) main.invoke(null, "aaa", TypeInfo.STRING_TYPE_INFO, TypeInfo.INT_TYPE_INFO, Arrays.asList(10));
|
||||
Tuple4 tuple4 = (Tuple4) main.invoke(null, "aaa", Arrays.asList(10));
|
||||
assertEquals(1, tuple4._1);
|
||||
assertEquals("foo", tuple4._2);
|
||||
assertEquals("aaa", tuple4._3);
|
||||
|
||||
@@ -105,13 +105,13 @@ public class PatternMatchingTest extends CodegenTestCase {
|
||||
Method foo = generateFunction();
|
||||
final Object result;
|
||||
try {
|
||||
result = foo.invoke(null, new Tuple2<Integer, Integer>(null, 1, 2));
|
||||
result = foo.invoke(null, new Tuple2<Integer, Integer>(1, 2));
|
||||
} catch (Exception e) {
|
||||
System.out.println(generateToText());
|
||||
throw e;
|
||||
}
|
||||
assertEquals("one,two", result);
|
||||
assertEquals("something", foo.invoke(null, new Tuple2<String, String>(null, "not", "tuple")));
|
||||
assertEquals("something", foo.invoke(null, new Tuple2<String, String>("not", "tuple")));
|
||||
}
|
||||
|
||||
// Commented for KT-621
|
||||
@@ -135,8 +135,8 @@ public class PatternMatchingTest extends CodegenTestCase {
|
||||
public void testNames() throws Exception {
|
||||
loadText("fun foo(x: #(Any, Any)) = when(x) { is #(val a is String, *) -> a; else -> \"something\" }");
|
||||
Method foo = generateFunction();
|
||||
assertEquals("JetBrains", foo.invoke(null, new Tuple2<String, String>(null, "JetBrains", "s.r.o.")));
|
||||
assertEquals("something", foo.invoke(null, new Tuple2<Integer, Integer>(null, 1, 2)));
|
||||
assertEquals("JetBrains", foo.invoke(null, new Tuple2<String, String>("JetBrains", "s.r.o.")));
|
||||
assertEquals("something", foo.invoke(null, new Tuple2<Integer, Integer>(1, 2)));
|
||||
}
|
||||
|
||||
public void testMultipleConditions() throws Exception {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class PropertyGenTest extends CodegenTestCase {
|
||||
loadFile();
|
||||
final Class aClass = loadImplementationClass(generateClassesInFile(), "PrivateVal");
|
||||
final Field[] fields = aClass.getDeclaredFields();
|
||||
assertEquals(2, fields.length); // $typeInfo, prop
|
||||
assertEquals(1, fields.length); // prop
|
||||
final Field field = fields[0];
|
||||
assertEquals("prop", field.getName());
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ package org.jetbrains.jet.codegen;
|
||||
public class TupleGenTest extends CodegenTestCase {
|
||||
public void testBasic() {
|
||||
blackBoxFile("/tuples/basic.jet");
|
||||
// System.out.println(generateToText());
|
||||
System.out.println(generateToText());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
import jet.JetObject;
|
||||
import jet.TypeCastException;
|
||||
import jet.TypeInfo;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class TypeInfoTest extends CodegenTestCase {
|
||||
@Override
|
||||
@@ -31,28 +31,6 @@ public class TypeInfoTest extends CodegenTestCase {
|
||||
return "typeInfo";
|
||||
}
|
||||
|
||||
public void testGetTypeInfo() throws Exception {
|
||||
loadFile();
|
||||
Method foo = generateFunction();
|
||||
JetObject jetObject = (JetObject) foo.invoke(null);
|
||||
TypeInfo<?> typeInfo = jetObject.getTypeInfo();
|
||||
assertNotNull(typeInfo);
|
||||
}
|
||||
|
||||
public void testOneArgTypeinfo() throws Exception {
|
||||
loadFile();
|
||||
Method foo = generateFunction();
|
||||
TypeInfo typeInfo = (TypeInfo) foo.invoke(null);
|
||||
assertNotNull(typeInfo);
|
||||
}
|
||||
|
||||
public void testNoArgTypeinfo() throws Exception {
|
||||
loadText("fun foo() = typeinfo<Int>()");
|
||||
Method foo = generateFunction();
|
||||
TypeInfo typeInfo = (TypeInfo) foo.invoke(null);
|
||||
assertSame(TypeInfo.INT_TYPE_INFO, typeInfo);
|
||||
}
|
||||
|
||||
public void testAsSafeOperator() throws Exception {
|
||||
loadText("fun foo(x: Any) = x as? Runnable");
|
||||
Method foo = generateFunction();
|
||||
@@ -94,19 +72,22 @@ public class TypeInfoTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testIsWithGenericParameters() throws Exception {
|
||||
loadFile();
|
||||
Method foo = generateFunction();
|
||||
assertFalse((Boolean) foo.invoke(null));
|
||||
// todo: obsolete with typeinfo removal
|
||||
// loadFile();
|
||||
// Method foo = generateFunction();
|
||||
// assertFalse((Boolean) foo.invoke(null));
|
||||
}
|
||||
|
||||
public void testIsTypeParameter() throws Exception {
|
||||
blackBoxFile("typeInfo/isTypeParameter.jet");
|
||||
// todo: obsolete with typeinfo removal
|
||||
// blackBoxFile("typeInfo/isTypeParameter.jet");
|
||||
}
|
||||
|
||||
public void testAsSafeWithGenerics() throws Exception {
|
||||
loadFile();
|
||||
Method foo = generateFunction();
|
||||
assertNull(foo.invoke(null));
|
||||
// todo: obsolete with typeinfo removal
|
||||
// loadFile();
|
||||
// Method foo = generateFunction();
|
||||
// assertNull(foo.invoke(null));
|
||||
}
|
||||
|
||||
public void testAsInLoop() throws Exception {
|
||||
@@ -119,18 +100,22 @@ public class TypeInfoTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testNullability() throws Exception {
|
||||
blackBoxFile("typeInfo/nullability.jet");
|
||||
// todo: obsolete with typeinfo removal
|
||||
// blackBoxFile("typeInfo/nullability.jet");
|
||||
}
|
||||
|
||||
public void testGenericFunction() throws Exception {
|
||||
blackBoxFile("typeInfo/genericFunction.jet");
|
||||
// todo: obsolete with typeinfo removal
|
||||
// blackBoxFile("typeInfo/genericFunction.jet");
|
||||
}
|
||||
|
||||
public void testForwardTypeParameter() throws Exception {
|
||||
blackBoxFile("typeInfo/forwardTypeParameter.jet");
|
||||
// todo: obsolete with typeinfo removal
|
||||
// blackBoxFile("typeInfo/forwardTypeParameter.jet");
|
||||
}
|
||||
|
||||
public void testClassObjectInTypeInfo() throws Exception {
|
||||
/*
|
||||
loadFile();
|
||||
// System.out.println(generateToText());
|
||||
Method foo = generateFunction();
|
||||
@@ -139,6 +124,7 @@ public class TypeInfoTest extends CodegenTestCase {
|
||||
final Object object = typeInfo.getClassObject();
|
||||
final Method classObjFoo = object.getClass().getMethod("foo");
|
||||
assertNotNull(classObjFoo);
|
||||
*/
|
||||
}
|
||||
|
||||
private Runnable newRunnable() {
|
||||
@@ -150,7 +136,8 @@ public class TypeInfoTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testKt259() throws Exception {
|
||||
blackBoxFile("regressions/kt259.jet");
|
||||
// todo: obsolete with typeinfo removal
|
||||
// blackBoxFile("regressions/kt259.jet");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
|
||||
@@ -170,7 +157,8 @@ public class TypeInfoTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testkt1113() throws Exception {
|
||||
blackBoxFile("regressions/kt1113.kt");
|
||||
System.out.println(generateToText());
|
||||
// todo: obsolete with typeinfo removal
|
||||
// blackBoxFile("regressions/kt1113.kt");
|
||||
// System.out.println(generateToText());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class VarArgTest extends CodegenTestCase {
|
||||
|
||||
public void testArrayT () throws InvocationTargetException, IllegalAccessException {
|
||||
loadText("fun test() = _array(2, 4); fun <T> _array(vararg elements : T) = elements");
|
||||
// System.out.println(generateToText());
|
||||
System.out.println(generateToText());
|
||||
final Method main = generateFunction("test");
|
||||
Object res = main.invoke(null);
|
||||
assertTrue(((Integer[])res).length == 2);
|
||||
|
||||
@@ -108,8 +108,9 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
||||
}
|
||||
|
||||
public void testTypeInfo() throws Exception {
|
||||
assertType("typeinfo<Int>", "TypeInfo<Int>");
|
||||
assertType("typeinfo<TypeInfo<Int>>", "TypeInfo<TypeInfo<Int>>");
|
||||
// todo: obsolete since removal of typeinfo
|
||||
// assertType("typeinfo<Int>", "TypeInfo<Int>");
|
||||
// assertType("typeinfo<TypeInfo<Int>>", "TypeInfo<TypeInfo<Int>>");
|
||||
}
|
||||
|
||||
public void testJumps() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user