diff --git a/bootstrap.xml b/bootstrap.xml
index 52b29aca855..695ce5f2e03 100644
--- a/bootstrap.xml
+++ b/bootstrap.xml
@@ -10,6 +10,7 @@
+
diff --git a/build.xml b/build.xml
index bc0ee63e9f7..6c91c946fa5 100644
--- a/build.xml
+++ b/build.xml
@@ -20,7 +20,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java b/compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java
index ce0eb62f800..a1135e9c65c 100644
--- a/compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java
+++ b/compiler/backend/src/org/jetbrains/jet/codegen/CodegenContext.java
@@ -10,6 +10,7 @@ import org.objectweb.asm.commons.InstructionAdapter;
import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
/*
* @author max
@@ -38,6 +39,8 @@ public abstract class CodegenContext {
public final ObjectOrClosureCodegen closure;
HashMap typeInfoConstants;
+ HashMap reverseTypeInfoConstants;
+ int typeInfoConstantsCount;
HashMap accessors;
protected StackValue outerExpression;
@@ -177,13 +180,16 @@ public abstract class CodegenContext {
if(parentContext != STATIC)
return parentContext.getTypeInfoConstantIndex(type);
- if(typeInfoConstants == null)
- typeInfoConstants = new HashMap();
+ if(typeInfoConstants == null) {
+ typeInfoConstants = new LinkedHashMap();
+ reverseTypeInfoConstants = new LinkedHashMap();
+ }
Integer index = typeInfoConstants.get(type);
if(index == null) {
- index = typeInfoConstants.size();
+ index = typeInfoConstantsCount++;
typeInfoConstants.put(type, index);
+ reverseTypeInfoConstants.put(index, type);
}
return index;
}
diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java
index 923a503c6d4..0aa482db4b4 100644
--- a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java
+++ b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java
@@ -2068,14 +2068,14 @@ public class ExpressionCodegen extends JetVisitor {
return type;
}
- private void generateNewArray(JetCallExpression expression, JetType arrayType) {
+ public void generateNewArray(JetCallExpression expression, JetType arrayType) {
List extends ValueArgument> args = expression.getValueArguments();
boolean isArray = state.getStandardLibrary().getArray().equals(arrayType.getConstructor().getDeclarationDescriptor());
if(isArray) {
- if (args.size() != 2 && !arrayType.getArguments().get(0).getType().isNullable()) {
- throw new CompilationException("array constructor of non-nullable type requires two arguments");
- }
+// if (args.size() != 2 && !arrayType.getArguments().get(0).getType().isNullable()) {
+// throw new CompilationException("array constructor of non-nullable type requires two arguments");
+// }
}
else {
if (args.size() != 1) {
@@ -2445,18 +2445,28 @@ If finally block is present, its last expression is the value of try expression.
return StackValue.onStack(Type.BOOLEAN_TYPE);
}
+ public boolean hasTypeInfoForInstanceOf(JetType type) {
+ DeclarationDescriptor declarationDescriptor = type.getConstructor().getDeclarationDescriptor();
+ if(declarationDescriptor instanceof TypeParameterDescriptor)
+ return true;
+
+ ClassDescriptor classDescriptor = (ClassDescriptor) declarationDescriptor.getOriginal();
+ if(classDescriptor.equals(state.getStandardLibrary().getArray())) {
+ return hasTypeInfoForInstanceOf(type.getArguments().get(0).getType());
+ }
+
+ for(TypeParameterDescriptor proj : classDescriptor.getTypeConstructor().getParameters()) {
+ if(proj.isReified()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
private void generateInstanceOf(StackValue expressionToGen, JetType jetType, boolean leaveExpressionOnStack) {
DeclarationDescriptor descriptor = jetType.getConstructor().getDeclarationDescriptor();
- boolean javaClass = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor) instanceof PsiClass;
- if (!javaClass && (jetType.getArguments().size() > 0 || !(descriptor instanceof ClassDescriptor))) {
- generateTypeInfo(jetType);
- expressionToGen.put(OBJECT_TYPE, v);
- if (leaveExpressionOnStack) {
- v.dupX1();
- }
- v.invokevirtual("jet/typeinfo/TypeInfo", "isInstance", "(Ljava/lang/Object;)Z");
- }
- else {
+ if (!hasTypeInfoForInstanceOf(jetType)) {
expressionToGen.put(OBJECT_TYPE, v);
if (leaveExpressionOnStack) {
v.dup();
@@ -2479,6 +2489,14 @@ If finally block is present, its last expression is the value of try expression.
v.instanceOf(type);
}
}
+ else {
+ generateTypeInfo(jetType);
+ expressionToGen.put(OBJECT_TYPE, v);
+ if (leaveExpressionOnStack) {
+ v.dupX1();
+ }
+ v.invokevirtual("jet/typeinfo/TypeInfo", "isInstance", "(Ljava/lang/Object;)Z");
+ }
}
public void generateTypeInfo(JetType jetType) {
diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java
index 908c8d29867..837c1503717 100644
--- a/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java
+++ b/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java
@@ -14,9 +14,7 @@ import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.InstructionAdapter;
-import java.util.Collections;
import java.util.List;
-import java.util.Map;
import static org.objectweb.asm.Opcodes.*;
@@ -114,11 +112,12 @@ public class NamespaceCodegen {
private void generateTypeInfoFields(JetNamespace namespace, CodegenContext context) {
if(context.typeInfoConstants != null) {
String jvmClassName = getJVMClassName(namespace.getName());
- for(Map.Entry e : (context.typeInfoConstants != null ? context.typeInfoConstants : Collections.emptyMap()).entrySet()) {
- String fieldName = "$typeInfoCache$" + e.getValue();
+ for(int index = 0; index != context.typeInfoConstantsCount; index++) {
+ JetType type = context.reverseTypeInfoConstants.get(index);
+ String fieldName = "$typeInfoCache$" + index;
v.newField(null, ACC_PRIVATE | ACC_STATIC | ACC_SYNTHETIC, fieldName, "Ljet/typeinfo/TypeInfo;", null, null);
- MethodVisitor mmv = v.newMethod(null, ACC_PUBLIC | ACC_STATIC | ACC_SYNTHETIC, "$getCachedTypeInfo$" + e.getValue(), "()Ljet/typeinfo/TypeInfo;", null, null);
+ MethodVisitor mmv = v.newMethod(null, ACC_PUBLIC | ACC_STATIC | ACC_SYNTHETIC, "$getCachedTypeInfo$" + index, "()Ljet/typeinfo/TypeInfo;", null, null);
InstructionAdapter v = new InstructionAdapter(mmv);
v.visitFieldInsn(GETSTATIC, jvmClassName, fieldName, "Ljet/typeinfo/TypeInfo;");
v.visitInsn(DUP);
@@ -126,7 +125,7 @@ public class NamespaceCodegen {
v.visitJumpInsn(IFNONNULL, end);
v.pop();
- generateTypeInfo(context, v, e.getKey(), state.getTypeMapper(), e.getKey());
+ generateTypeInfo(context, v, type, state.getTypeMapper(), type);
v.dup();
v.visitFieldInsn(PUTSTATIC, jvmClassName, fieldName, "Ljet/typeinfo/TypeInfo;");
diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/Increment.java b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/Increment.java
index 8c199a571a3..fc1292cf899 100644
--- a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/Increment.java
+++ b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/Increment.java
@@ -5,6 +5,7 @@ import org.jetbrains.jet.codegen.ExpressionCodegen;
import org.jetbrains.jet.codegen.JetTypeMapper;
import org.jetbrains.jet.codegen.StackValue;
import org.jetbrains.jet.lang.psi.JetExpression;
+import org.jetbrains.jet.lang.psi.JetParenthesizedExpression;
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.InstructionAdapter;
@@ -23,7 +24,10 @@ public class Increment implements IntrinsicMethod {
@Override
public StackValue generate(ExpressionCodegen codegen, InstructionAdapter v, Type expectedType, PsiElement element, List arguments, StackValue receiver) {
- final JetExpression operand = arguments.get(0);
+ JetExpression operand = arguments.get(0);
+ while(operand instanceof JetParenthesizedExpression) {
+ operand = ((JetParenthesizedExpression)operand).getExpression();
+ }
if (operand instanceof JetReferenceExpression) {
final int index = codegen.indexOfLocal((JetReferenceExpression) operand);
if (index >= 0 && JetTypeMapper.isIntPrimitive(expectedType)) {
@@ -33,6 +37,7 @@ public class Increment implements IntrinsicMethod {
}
StackValue value = codegen.genQualified(receiver, operand);
value. dupReceiver(v);
+ value. dupReceiver(v);
value.put(expectedType, v);
if (expectedType == Type.LONG_TYPE) {
v.lconst(myDelta);
@@ -44,10 +49,11 @@ public class Increment implements IntrinsicMethod {
v.dconst(myDelta);
}
else {
- v.aconst(myDelta);
+ v.iconst(myDelta);
}
v.add(expectedType);
value.store(v);
- return value;
+ value.put(expectedType, v);
+ return StackValue.onStack(expectedType);
}
}
diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java
index a75db2d5a37..e86d46bfb8e 100644
--- a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java
+++ b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java
@@ -15,6 +15,7 @@ import org.jetbrains.jet.lang.types.JetStandardLibrary;
import org.jetbrains.jet.lang.types.TypeProjection;
import org.jetbrains.jet.plugin.JetFileType;
import org.objectweb.asm.Opcodes;
+import sun.tools.tree.NewArrayExpression;
import java.util.*;
@@ -85,6 +86,7 @@ public class IntrinsicMethods {
declareOverload(myStdLib.getLibraryScope().getFunctions("equals"), 1, EQUALS);
declareOverload(myStdLib.getLibraryScope().getFunctions("identityEquals"), 1, EQUALS);
declareOverload(myStdLib.getLibraryScope().getFunctions("plus"), 1, new StringPlus());
+ declareOverload(myStdLib.getLibraryScope().getFunctions("Array"), 1, new NewArray());
declareIntrinsicFunction("ByteIterator", "next", 0, ITERATOR_NEXT);
declareIntrinsicFunction("ShortIterator", "next", 0, ITERATOR_NEXT);
diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/NewArray.java b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/NewArray.java
new file mode 100644
index 00000000000..318dfcfdf7f
--- /dev/null
+++ b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/NewArray.java
@@ -0,0 +1,24 @@
+package org.jetbrains.jet.codegen.intrinsics;
+
+import com.intellij.psi.PsiElement;
+import org.jetbrains.jet.codegen.ExpressionCodegen;
+import org.jetbrains.jet.codegen.JetTypeMapper;
+import org.jetbrains.jet.codegen.StackValue;
+import org.jetbrains.jet.lang.psi.JetCallExpression;
+import org.jetbrains.jet.lang.psi.JetExpression;
+import org.jetbrains.jet.lang.resolve.BindingContext;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.InstructionAdapter;
+
+import java.util.List;
+
+/**
+ * @author alex.tkachman
+ */
+public class NewArray implements IntrinsicMethod {
+ @Override
+ public StackValue generate(ExpressionCodegen codegen, InstructionAdapter v, Type expectedType, PsiElement element, List arguments, StackValue receiver) {
+ codegen.generateNewArray((JetCallExpression) element, codegen.getBindingContext().get(BindingContext.EXPRESSION_TYPE, (JetExpression) element));
+ return StackValue.onStack(expectedType);
+ }
+}
diff --git a/compiler/frontend/src/jet/Library.jet b/compiler/frontend/src/jet/Library.jet
index 24a7f4e962f..279171d8776 100644
--- a/compiler/frontend/src/jet/Library.jet
+++ b/compiler/frontend/src/jet/Library.jet
@@ -105,7 +105,9 @@ trait Iterable {
fun iterator() : Iterator
}
-class Array(val size : Int, init : fun(Int) : T = null ) {
+fun Array(val size : Int) : Array
+
+class Array(val size : Int, init : fun(Int) : T) {
fun get(index : Int) : T
fun set(index : Int, value : T) : Unit
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java
index 02bd8737c36..59941479937 100644
--- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java
@@ -16,7 +16,6 @@ import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.Iterator;
-import java.util.List;
import static org.jetbrains.jet.lang.diagnostics.Severity.ERROR;
import static org.jetbrains.jet.lang.diagnostics.Severity.WARNING;
@@ -374,7 +373,7 @@ public interface Errors {
ParameterizedDiagnosticFactory2 ABSTRACT_MEMBER_NOT_IMPLEMENTED = new ParameterizedDiagnosticFactory2(ERROR, "Class ''{0}'' must be declared abstract or implement abstract member {1}") {
@Override
protected String makeMessageForA(@NotNull JetClassOrObject jetClassOrObject) {
- return jetClassOrObject.getName();
+ return JetPsiUtil.safeName(jetClassOrObject.getName());
}
@Override
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/JetStandardLibrary.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/JetStandardLibrary.java
index 62923713125..c095764a3ab 100644
--- a/compiler/frontend/src/org/jetbrains/jet/lang/types/JetStandardLibrary.java
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/JetStandardLibrary.java
@@ -284,7 +284,7 @@ public class JetStandardLibrary {
}
@NotNull
- public ClassDescriptor getArray() {
+ public ClassDescriptor getArray() {
initStdClasses();
return arrayClass;
}
diff --git a/compiler/frontend/src/org/jetbrains/jet/resolve/DescriptorRenderer.java b/compiler/frontend/src/org/jetbrains/jet/resolve/DescriptorRenderer.java
index 4eeb1635dc3..991c3ced6a9 100644
--- a/compiler/frontend/src/org/jetbrains/jet/resolve/DescriptorRenderer.java
+++ b/compiler/frontend/src/org/jetbrains/jet/resolve/DescriptorRenderer.java
@@ -73,8 +73,8 @@ public class DescriptorRenderer implements Renderer {
}
public String renderType(JetType type) {
- if (type != null) {
- return escape(">");
+ if (type == null) {
+ return escape("[NULL]");
} else {
return escape(type.toString());
}
diff --git a/compiler/testData/checkerWithErrorTypes/quick/UnusedVariables.jet b/compiler/testData/checkerWithErrorTypes/quick/UnusedVariables.jet
index c52c8e8e61d..63fbca9007e 100644
--- a/compiler/testData/checkerWithErrorTypes/quick/UnusedVariables.jet
+++ b/compiler/testData/checkerWithErrorTypes/quick/UnusedVariables.jet
@@ -50,7 +50,7 @@ class MyTest() {
i = 456;
}
- fun testWhile(a : Any?, b : Any?) {
+ fun testWhile() {
var a : Any? = true
var b : Any? = 34
while (a is Any) {
@@ -139,4 +139,4 @@ fun testBackingFieldsNotMarked() {
}
}
-fun doSmth(i : Int) {}
\ No newline at end of file
+fun doSmth(i : Int) {}
diff --git a/compiler/testData/codegen/regressions/kt602.jet b/compiler/testData/codegen/regressions/kt602.jet
new file mode 100644
index 00000000000..aae930a7328
--- /dev/null
+++ b/compiler/testData/codegen/regressions/kt602.jet
@@ -0,0 +1 @@
+fun box() = if(Array(10) is Array) "OK" else "fail"
diff --git a/compiler/testData/codegen/regressions/kt613.jet b/compiler/testData/codegen/regressions/kt613.jet
new file mode 100644
index 00000000000..463b77aa909
--- /dev/null
+++ b/compiler/testData/codegen/regressions/kt613.jet
@@ -0,0 +1,15 @@
+namespace name
+
+class Test() {
+ var i = 5
+ val ten = 10.lng
+
+ fun Long.t() = this.int + i++ + ++i
+
+ fun tt() = ten.t()
+}
+
+fun box() : String {
+ var m = Test()
+ return if((m.i)++ == 5 && ++(m.i) == 7 && m.tt() == 26) "OK" else "fail"
+}
\ No newline at end of file
diff --git a/compiler/tests/org/jetbrains/jet/codegen/ArrayGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ArrayGenTest.java
index 80063a36516..f5e8faf941a 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/ArrayGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/ArrayGenTest.java
@@ -9,7 +9,7 @@ public class ArrayGenTest extends CodegenTestCase {
public void testKt326 () throws Exception {
blackBoxFile("regressions/kt326.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testCreateMultiInt () throws Exception {
@@ -39,7 +39,7 @@ public class ArrayGenTest extends CodegenTestCase {
public void testCreateMultiGenerics () throws Exception {
loadText("class L() { val a = Array(5) } fun foo() = L.a");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
Object invoke = foo.invoke(null);
System.out.println(invoke.getClass());
@@ -48,7 +48,7 @@ public class ArrayGenTest extends CodegenTestCase {
public void testIntGenerics () throws Exception {
loadText("class L(var a : T) {} fun foo() = L(5).a");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
Object invoke = foo.invoke(null);
System.out.println(invoke.getClass());
@@ -57,147 +57,147 @@ public class ArrayGenTest extends CodegenTestCase {
public void testIterator () throws Exception {
loadText("fun box() { val x = Array(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);
}
public void testPrimitiveIterator () throws Exception {
loadText("fun box() { val x = ByteArray(5).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.nextByte()) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testPrimitiveIteratorByte () throws Exception {
loadText("fun box() { for(x in ByteArray(5)) { java.lang.System.out?.println(x) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testPrimitiveIteratorShort () throws Exception {
loadText("fun box() { for(x in ShortArray(5)) { java.lang.System.out?.println(x) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testPrimitiveIteratorInt () throws Exception {
loadText("fun box() { for(x in IntArray(5)) { java.lang.System.out?.println(x) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testPrimitiveIteratorLong () throws Exception {
loadText("fun box() { for(x in LongArray(5)) { java.lang.System.out?.println(x) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testPrimitiveIteratorFloat () throws Exception {
loadText("fun box() { for(x in FloatArray(5)) { java.lang.System.out?.println(x) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testPrimitiveIteratorDouble () throws Exception {
loadText("fun box() { for(x in DoubleArray(5)) { java.lang.System.out?.println(x) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testPrimitiveIteratorChar () throws Exception {
loadText("fun box() { for(x in CharArray(5)) { java.lang.System.out?.println(x) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testPrimitiveIteratorBoolean () throws Exception {
loadText("fun box() { for(x in BooleanArray(5)) { java.lang.System.out?.println(x) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testLongIterator () throws Exception {
loadText("fun box() { val x = LongArray(5).iterator(); while(x.hasNext) { java.lang.System.out?.println(x.nextLong()) } }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
foo.invoke(null);
}
public void testCharIterator () throws Exception {
loadText("fun box() { val x = CharArray(5).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);
}
public void testByteIterator () throws Exception {
loadText("fun box() { val x = ByteArray(5).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);
}
public void testShortIterator () throws Exception {
loadText("fun box() { val x = ShortArray(5).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);
}
public void testIntIterator () throws Exception {
loadText("fun box() { val x = IntArray(5).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);
}
public void testLongIterator2 () throws Exception {
loadText("fun box() { val x = LongArray(5).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);
}
public void testFloatIterator () throws Exception {
loadText("fun box() { val x = FloatArray(5).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);
}
public void testDoubleIterator () throws Exception {
loadText("fun box() { val x = ShortArray(5).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);
}
public void testBooleanIterator () throws Exception {
loadText("fun box() { val x = BooleanArray(5).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);
}
public void testArrayIndices () throws Exception {
loadText("fun box() { val x = Array(5, {it}).indices.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);
}
public void testCharIndices () throws Exception {
loadText("fun box() { val x = CharArray(5).indices.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);
}
@@ -208,7 +208,7 @@ public class ArrayGenTest extends CodegenTestCase {
public void testArrayPlusAssign () throws Exception {
loadText("fun box() : Int { val s = IntArray(1); s [0] = 5; s[0] += 7; return s[0] }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
assertTrue((Integer)foo.invoke(null) == 12);
}
@@ -218,7 +218,7 @@ public class ArrayGenTest extends CodegenTestCase {
"fun box() : String { val s = ArrayList(1); s.add(\"\"); s [1, -1] = \"5\"; s[2, -2] += \"7\"; return s[2,-2] }\n" +
"fun ArrayList.get(index1: Int, index2 : Int) = this[index1+index2]\n" +
"fun ArrayList.set(index1: Int, index2 : Int, elem: String) { this[index1+index2] = elem }\n");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction("box");
assertTrue(foo.invoke(null).equals("57"));
}
@@ -228,7 +228,7 @@ public class ArrayGenTest extends CodegenTestCase {
"fun box() : String? { val s = Array(1,{ \"\" }); s [1, -1] = \"5\"; s[2, -2] += \"7\"; return s[-3,3] }\n" +
"fun Array.get(index1: Int, index2 : Int) = this[index1+index2]\n" +
"fun Array.set(index1: Int, index2 : Int, elem: String) { this[index1+index2] = elem\n }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction("box");
assertTrue(foo.invoke(null).equals("57"));
}
@@ -238,7 +238,7 @@ public class ArrayGenTest extends CodegenTestCase {
"fun box() : String { val s = ArrayList(1); s.add(\"\"); s [1, -1] = \"5\"; return s[2, -2] }\n" +
"fun ArrayList.get(index1: Int, index2 : Int) = this[index1+index2]\n" +
"fun ArrayList.set(index1: Int, index2 : Int, elem: String) { this[index1+index2] = elem }\n");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction("box");
assertTrue(foo.invoke(null).equals("5"));
}
@@ -248,7 +248,7 @@ public class ArrayGenTest extends CodegenTestCase {
"fun box() : String? { val s = Array(1,{ \"\" }); s [1, -1] = \"5\"; return s[-2, 2] }\n" +
"fun Array.get(index1: Int, index2 : Int) = this[index1+index2]\n" +
"fun Array.set(index1: Int, index2 : Int, elem: String) { this[index1+index2] = elem\n }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction("box");
assertTrue(foo.invoke(null).equals("5"));
}
@@ -257,7 +257,7 @@ public class ArrayGenTest extends CodegenTestCase {
loadText(
"fun box() : Int? { val s = java.util.HashMap(); s[\"239\"] = 239; return s[\"239\"] }\n" +
"fun java.util.HashMap.set(index: String, elem: Int?) { this.put(index, elem) }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction("box");
assertTrue((Integer)foo.invoke(null) == 239);
}
@@ -267,7 +267,7 @@ public class ArrayGenTest extends CodegenTestCase {
"fun box() : Int { var l = IntArray(1); l[0.lng] = 4; l[0.lng] += 6; return l[0.lng];}\n" +
"fun IntArray.set(index: Long, elem: Int) { this[index.int] = elem }\n" +
"fun IntArray.get(index: Long) = this[index.int]");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction("box");
assertTrue((Integer)foo.invoke(null) == 10);
}
@@ -276,9 +276,14 @@ public class ArrayGenTest extends CodegenTestCase {
blackBoxFile("regressions/kt503.jet");
}
+ public void testKt602() {
+ blackBoxFile("regressions/kt602.jet");
+// System.out.println(generateToText());
+ }
+
public void testKt594() throws Exception {
loadFile("regressions/kt594.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
blackBox();
}
}
diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java
index 6b44f7b8d94..1f300ca6406 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java
@@ -49,7 +49,7 @@ public class ClassGenTest extends CodegenTestCase {
public void testNewInstanceExplicitConstructor() throws Exception {
loadFile("classes/newInstanceDefaultConstructor.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method method = generateFunction("test");
final Integer returnValue = (Integer) method.invoke(null);
assertEquals(610, returnValue.intValue());
@@ -149,7 +149,7 @@ public class ClassGenTest extends CodegenTestCase {
public void testEnumClass() throws Exception {
loadText("enum class Direction { NORTH; SOUTH; EAST; WEST }");
final Class direction = loadAllClasses(generateClassesInFile()).get("Direction");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Field north = direction.getField("NORTH");
assertEquals(direction, north.getType());
assertInstanceOf(north.get(null), direction);
@@ -170,36 +170,36 @@ public class ClassGenTest extends CodegenTestCase {
public void testKt48 () throws Exception {
blackBoxFile("regressions/kt48.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testKt309 () throws Exception {
loadText("fun box() = null");
final Method method = generateFunction("box");
assertEquals(method.getReturnType().getName(), "java.lang.Object");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testKt343 () throws Exception {
blackBoxFile("regressions/kt343.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testKt344 () throws Exception {
loadFile("regressions/kt344.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
blackBox();
}
public void testKt508 () throws Exception {
loadFile("regressions/kt508.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
blackBox();
}
public void testKt504 () throws Exception {
loadFile("regressions/kt504.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
blackBox();
}
@@ -209,7 +209,7 @@ public class ClassGenTest extends CodegenTestCase {
public void testKt496 () throws Exception {
blackBoxFile("regressions/kt496.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testKt500 () throws Exception {
diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClosuresGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClosuresGenTest.java
index 07b094c344d..9533317fbb2 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/ClosuresGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/ClosuresGenTest.java
@@ -6,7 +6,7 @@ package org.jetbrains.jet.codegen;
public class ClosuresGenTest extends CodegenTestCase {
public void testSimplestClosure() throws Exception {
blackBoxFile("classes/simplestClosure.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testSimplestClosureAndBoxing() throws Exception {
@@ -27,7 +27,7 @@ public class ClosuresGenTest extends CodegenTestCase {
public void testEnclosingLocalVariable() throws Exception {
blackBoxFile("classes/enclosingLocalVariable.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testDoubleEnclosedLocalVariable() throws Exception {
diff --git a/compiler/tests/org/jetbrains/jet/codegen/ControlStructuresTest.java b/compiler/tests/org/jetbrains/jet/codegen/ControlStructuresTest.java
index 11914b419ac..0c1d8f4aa41 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/ControlStructuresTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/ControlStructuresTest.java
@@ -17,7 +17,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testIf() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(15, main.invoke(null, true));
assertEquals(20, main.invoke(null, false));
@@ -26,7 +26,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testSingleBranchIf() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(15, main.invoke(null, true));
assertEquals(20, main.invoke(null, false));
@@ -47,7 +47,7 @@ public class ControlStructuresTest extends CodegenTestCase {
private void factorialTest(final String name) throws IllegalAccessException, InvocationTargetException {
loadFile(name);
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(6, main.invoke(null, 3));
assertEquals(120, main.invoke(null, 5));
@@ -55,7 +55,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testContinue() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(3, main.invoke(null, 4));
assertEquals(7, main.invoke(null, 5));
@@ -63,7 +63,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testIfNoElse() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(5, main.invoke(null, 5, true));
assertEquals(10, main.invoke(null, 5, false));
@@ -78,7 +78,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testFor() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
List args = Arrays.asList("IntelliJ", " ", "IDEA");
assertEquals("IntelliJ IDEA", main.invoke(null, args));
@@ -86,7 +86,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testIfBlock() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
List args = Arrays.asList("IntelliJ", " ", "IDEA");
assertEquals("TTT", main.invoke(null, args));
@@ -96,7 +96,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testForInArray() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
String[] args = new String[] { "IntelliJ", " ", "IDEA" };
assertEquals("IntelliJ IDEA", main.invoke(null, new Object[] { args }));
@@ -126,7 +126,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testTryCatch() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals("no message", main.invoke(null, "0"));
assertEquals("For input string: \"a\"", main.invoke(null, "a"));
@@ -134,7 +134,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testTryFinally() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
StringBuilder sb = new StringBuilder();
main.invoke(null, sb, "9");
@@ -187,8 +187,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testCompareToNonnullableEq() throws Exception {
loadText("fun foo(a: String?, b: String): Boolean = a == b || b == a");
- String text = generateToText();
- System.out.println(text);
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(false, main.invoke(null, null, "lala"));
assertEquals(true, main.invoke(null, "papa", "papa"));
@@ -197,7 +196,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testCompareToNonnullableNotEq() throws Exception {
loadText("fun foo(a: String?, b: String): Boolean = a != b");
String text = generateToText();
- System.out.println(text);
+// System.out.println(text);
assertTrue(text.contains("IXOR"));
final Method main = generateFunction();
assertEquals(true, main.invoke(null, null, "lala"));
@@ -210,7 +209,7 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testKt416() throws Exception {
blackBoxFile("regressions/kt416.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testKt513() throws Exception {
diff --git a/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java
index ceacbc22fe6..8ab99d48757 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/FunctionGenTest.java
@@ -9,17 +9,17 @@ import java.lang.reflect.Method;
public class FunctionGenTest extends CodegenTestCase {
public void testDefaultArgs() throws Exception {
blackBoxFile("functions/defaultargs.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testNoThisNoClosure() throws Exception {
blackBoxFile("functions/nothisnoclosure.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testAnyToString () throws InvocationTargetException, IllegalAccessException {
loadText("fun foo(x: Any) = x.toString()");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
assertEquals("something", foo.invoke(null, "something"));
assertEquals("null", foo.invoke(null, new Object[]{null}));
@@ -28,7 +28,7 @@ public class FunctionGenTest extends CodegenTestCase {
public void testNullableAnyToString () throws InvocationTargetException, IllegalAccessException {
loadText("fun foo(x: Any?) = x.toString()");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
assertEquals("something", foo.invoke(null, "something"));
assertEquals("null", foo.invoke(null, new Object[]{null}));
@@ -63,7 +63,7 @@ public class FunctionGenTest extends CodegenTestCase {
public void testAnyEqualsNullable () throws InvocationTargetException, IllegalAccessException {
loadText("fun foo(x: Any?) = x.equals(\"lala\")");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
assertTrue((Boolean) foo.invoke(null, "lala"));
assertFalse((Boolean) foo.invoke(null, "mama"));
@@ -71,7 +71,7 @@ public class FunctionGenTest extends CodegenTestCase {
public void testAnyEquals () throws InvocationTargetException, IllegalAccessException {
loadText("fun foo(x: Any) = x.equals(\"lala\")");
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
assertTrue((Boolean) foo.invoke(null, "lala"));
assertFalse((Boolean) foo.invoke(null, "mama"));
diff --git a/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java
index 9c88cfaec3e..81865f848af 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java
@@ -17,8 +17,7 @@ import java.util.Arrays;
public class NamespaceGenTest extends CodegenTestCase {
public void testPSVM() throws Exception {
loadFile("PSVM.jet");
- final String text = generateToText();
- System.out.println(text);
+// System.out.println(generateToText());
final Method main = generateFunction();
Object[] args = new Object[] { new String[0] };
@@ -27,8 +26,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testReturnOne() throws Exception {
loadText("fun f() : Int { return 42; }");
- final String text = generateToText();
- System.out.println(text);
+// System.out.println(generateToText());
final Method main = generateFunction();
final Object returnValue = main.invoke(null, new Object[0]);
@@ -37,8 +35,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testReturnA() throws Exception {
loadText("fun foo(a : Int) = a");
- final String text = generateToText();
- System.out.println(text);
+// System.out.println(generateToText());
final Method main = generateFunction();
final Object returnValue = main.invoke(null, 50);
@@ -47,8 +44,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testLocalProperty() throws Exception {
loadFile("localProperty.jet");
- final String text = generateToText();
- System.out.println(text);
+// System.out.println(generateToText());
final Method main = generateFunction();
final Object returnValue = main.invoke(null, 76);
@@ -57,7 +53,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testCurrentTime() throws Exception {
loadText("fun f() : Long { return System.currentTimeMillis(); }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
final long returnValue = (Long) main.invoke(null);
assertIsCurrentTime(returnValue);
@@ -65,7 +61,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testIdentityHashCode() throws Exception {
loadText("fun f(o: Any) : Int { return System.identityHashCode(o); }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Object o = new Object();
final int returnValue = (Integer) main.invoke(null, o);
@@ -82,7 +78,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testHelloWorld() throws Exception {
loadFile("helloWorld.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
generateFunction(); // assert that it can be verified
}
@@ -90,7 +86,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testAssign() throws Exception {
loadFile("assign.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(2, main.invoke(null));
}
@@ -116,7 +112,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testBoxVariable() throws Exception {
loadText("fun foo(): Int? { var x = 239; return x; }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(239, main.invoke(null));
}
@@ -173,14 +169,14 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testBottles2() throws Exception {
loadFile("bottles2.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
main.invoke(null); // ensure no exception
}
public void testJavaConstructor() throws Exception {
loadText("fun foo(): StringBuilder = StringBuilder()");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
final Object result = main.invoke(null);
assertTrue(result instanceof StringBuilder);
@@ -195,7 +191,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testJavaEquals() throws Exception {
loadText("fun foo(s1: String, s2: String) = s1 == s2");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(Boolean.TRUE, main.invoke(null, new String("jet"), new String("jet")));
assertEquals(Boolean.FALSE, main.invoke(null, new String("jet"), new String("ceylon")));
@@ -211,7 +207,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testJavaEqualsNull() throws Exception {
loadText("fun foo(s1: String?, s2: String?) = s1 == s2");
final Method main = generateFunction();
- System.out.println(generateToText());
+// System.out.println(generateToText());
assertEquals(Boolean.TRUE, main.invoke(null, null, null));
assertEquals(Boolean.FALSE, main.invoke(null, "jet", null));
assertEquals(Boolean.FALSE, main.invoke(null, null, "jet"));
@@ -220,7 +216,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testEqualsNullLiteral() throws Exception {
loadText("fun foo(s: String?) = s == null");
final Method main = generateFunction();
- System.out.println(generateToText());
+// System.out.println(generateToText());
assertEquals(Boolean.TRUE, main.invoke(null, new Object[] { null }));
assertEquals(Boolean.FALSE, main.invoke(null, "jet"));
}
@@ -245,7 +241,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testFunctionCall() throws Exception {
loadFile("functionCall.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction("f");
assertEquals("foo", main.invoke(null));
}
@@ -267,14 +263,14 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testStringPlusEq() throws Exception {
loadText("fun foo(s: String) : String { var result = s; result += s; return result; } ");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals("JarJar", main.invoke(null, "Jar"));
}
public void testStringCompare() throws Exception {
loadText("fun foo(s1: String, s2: String) = s1 < s2");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(Boolean.TRUE, main.invoke(null, "Ceylon", "Java"));
assertEquals(Boolean.FALSE, main.invoke(null, "Jet", "Java"));
@@ -302,7 +298,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testFieldRead() throws Exception {
loadText("import java.awt.*; fun foo(c: GridBagConstraints) = c.gridx");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
GridBagConstraints c = new GridBagConstraints();
c.gridx = 239;
@@ -319,7 +315,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testFieldIncrement() throws Exception {
loadText("import java.awt.*; fun foo(c: GridBagConstraints) { c.gridx++; return; }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
GridBagConstraints c = new GridBagConstraints();
c.gridx = 609;
@@ -329,7 +325,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testFieldAugAssign() throws Exception {
loadText("import java.awt.*; fun foo(c: GridBagConstraints) { c.gridx *= 2; return; }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
GridBagConstraints c = new GridBagConstraints();
c.gridx = 305;
@@ -358,7 +354,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testArrayAugAssign() throws Exception {
loadText("fun foo(c: Array) { c[0] *= 2 }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Integer[] data = new Integer[] { 5 };
main.invoke(null, new Object[] { data });
@@ -367,7 +363,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testArrayAugAssignLong() throws Exception {
loadText("fun foo(c: LongArray) { c[0] *= 2.lng }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
long[] data = new long[] { 5 };
main.invoke(null, new Object[] { data });
@@ -376,7 +372,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testArrayNew() throws Exception {
loadText("fun foo() = Array(4, { it })");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Integer[] result = (Integer[]) main.invoke(null);
assertEquals(4, result.length);
@@ -388,14 +384,14 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testArrayNewNullable() throws Exception {
loadText("fun foo() = Array(4)");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Integer[] result = (Integer[]) main.invoke(null);
assertEquals(4, result.length);
}
public void testFloatArrayNew() throws Exception {
loadText("fun foo() = FloatArray(4)");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
float[] result = (float[]) main.invoke(null);
assertEquals(4, result.length);
@@ -403,7 +399,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testFloatArrayArrayNew() throws Exception {
loadText("fun foo() = Array(4, { FloatArray(5-it) })");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
float[][] result = (float[][]) main.invoke(null);
assertEquals(4, result.length);
@@ -412,7 +408,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testArraySize() throws Exception {
loadText("fun foo(a: Array) = a.size");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Object[] args = new Object[] { new Integer[4] };
int result = (Integer) main.invoke(null, args);
@@ -422,7 +418,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testIntArraySize() throws Exception {
loadText("fun foo(a: IntArray) = a.size");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Object[] args = new Object[] { new int[4] };
int result = (Integer) main.invoke(null, args);
@@ -490,7 +486,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testTupleLiteral() throws Exception {
loadText("fun foo() = (1, \"foo\")");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Tuple2 tuple2 = (Tuple2) main.invoke(null);
assertEquals(1, tuple2._1);
@@ -499,7 +495,7 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testParametrizedTupleLiteral() throws Exception {
loadText("fun E.foo(extra: java.util.List) = (1, \"foo\", this, extra)");
- System.out.println(generateToText());
+// 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));
assertEquals(1, tuple4._1);
@@ -515,7 +511,7 @@ public class NamespaceGenTest extends CodegenTestCase {
assertNull(main.invoke(null, "IntelliJ"));
}
catch (Throwable t) {
- System.out.println(generateToText());
+// System.out.println(generateToText());
t.printStackTrace();
}
}
diff --git a/compiler/tests/org/jetbrains/jet/codegen/ObjectGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ObjectGenTest.java
index 53b76ccf788..05c5a66ca93 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/ObjectGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/ObjectGenTest.java
@@ -11,7 +11,7 @@ public class ObjectGenTest extends CodegenTestCase {
public void testObjectLiteral() throws Exception {
blackBoxFile("objects/objectLiteral.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testMethodOnObject() throws Exception {
diff --git a/compiler/tests/org/jetbrains/jet/codegen/PatternMatchingTest.java b/compiler/tests/org/jetbrains/jet/codegen/PatternMatchingTest.java
index a8d904c1707..a3fd95c3ab3 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/PatternMatchingTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/PatternMatchingTest.java
@@ -37,7 +37,7 @@ public class PatternMatchingTest extends CodegenTestCase {
public void testInrange() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
assertEquals("array list", foo.invoke(null, 239));
assertEquals("digit", foo.invoke(null, 0));
@@ -49,13 +49,13 @@ public class PatternMatchingTest extends CodegenTestCase {
public void testIs() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
blackBox();
}
public void testRange() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
assertEquals("array list", foo.invoke(null, 239));
assertEquals("digit", foo.invoke(null, 0));
@@ -67,7 +67,7 @@ public class PatternMatchingTest extends CodegenTestCase {
public void testRangeChar() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
assertEquals("digit", foo.invoke(null, '0'));
assertEquals("something", foo.invoke(null, 'A'));
diff --git a/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java b/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java
index 0a7b11175ea..e98e1b17a8b 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/PrimitiveTypesTest.java
@@ -10,7 +10,7 @@ public class PrimitiveTypesTest extends CodegenTestCase {
public void testPlus() throws Exception {
loadText("fun f(a: Int, b: Int): Int { return a + b }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
final int returnValue = (Integer) main.invoke(null, 37, 5);
@@ -20,7 +20,7 @@ public class PrimitiveTypesTest extends CodegenTestCase {
public void testGt() throws Exception {
loadText("fun foo(f: Int): Boolean { if (f > 0) return true; return false; }");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(true, main.invoke(null, 1));
assertEquals(false, main.invoke(null, 0));
@@ -57,7 +57,7 @@ public class PrimitiveTypesTest extends CodegenTestCase {
public void testLong() throws Exception {
loadText("fun foo(a: Long, b: Long): Long = a + b");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
long arg = (long) Integer.MAX_VALUE;
long expected = 2 * (long) Integer.MAX_VALUE;
@@ -66,7 +66,7 @@ public class PrimitiveTypesTest extends CodegenTestCase {
public void testLongCmp() throws Exception {
loadText("fun foo(a: Long, b: Long): Long = if (a == b) 0xffffffff else 0xfffffffe");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(0xffffffffL, main.invoke(null, 1, 1));
assertEquals(0xfffffffeL, main.invoke(null, 1, 0));
@@ -132,7 +132,7 @@ public class PrimitiveTypesTest extends CodegenTestCase {
public void testDoubleToInt() throws Exception {
loadText("fun foo(a: Double): Int = a.int");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(1, main.invoke(null, 1.0));
}
@@ -216,7 +216,7 @@ public class PrimitiveTypesTest extends CodegenTestCase {
public void testBitInv() throws Exception {
loadText("fun foo(a: Int): Int = a.inv()");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(0xffff0000, main.invoke(null, 0x0000ffff));
}
@@ -249,14 +249,14 @@ public class PrimitiveTypesTest extends CodegenTestCase {
public void testDecrementAsStatement() throws Exception {
loadFile("bottles.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
main.invoke(null); // ensure no exception
}
private void binOpTest(final String text, final Object arg1, final Object arg2, final Object expected) throws Exception {
loadText(text);
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(expected, main.invoke(null, arg1, arg2));
}
diff --git a/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java
index 096bd9e1c03..943064ca3bb 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java
@@ -64,7 +64,7 @@ public class PropertyGenTest extends CodegenTestCase {
public void testFieldPropertyAccess() throws Exception {
loadFile("properties/fieldPropertyAccess.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method method = generateFunction();
assertEquals(1, method.invoke(null));
assertEquals(2, method.invoke(null));
@@ -136,6 +136,10 @@ public class PropertyGenTest extends CodegenTestCase {
blackBoxFile("regressions/kt257.jet");
}
+ public void testKt613 () throws Exception {
+ blackBoxFile("regressions/kt613.jet");
+ }
+
public void testKt160() throws Exception {
loadText("internal val s = java.lang.Double.toString(1.0)");
final Method method = generateFunction("getS");
diff --git a/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java b/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java
index fdfbbecfa5b..7337274caac 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java
@@ -71,7 +71,7 @@ public class StdlibTest extends CodegenTestCase {
public void testInputStreamIterator () {
blackBoxFile("inputStreamIterator.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testKt533 () {
diff --git a/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java
index 86bbd2b935e..0b276174692 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java
@@ -3,21 +3,21 @@ package org.jetbrains.jet.codegen;
public class SuperGenTest extends CodegenTestCase {
public void testBasicProperty () {
blackBoxFile("/super/basicproperty.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testTraitProperty () {
blackBoxFile("/super/traitproperty.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testBasicMethod () {
blackBoxFile("/super/basicmethod.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testEnclosedMethod () {
blackBoxFile("/super/enclosed.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
}
diff --git a/compiler/tests/org/jetbrains/jet/codegen/TraitsTest.java b/compiler/tests/org/jetbrains/jet/codegen/TraitsTest.java
index b805c7d2147..4fd7093c08e 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/TraitsTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/TraitsTest.java
@@ -8,12 +8,12 @@ public class TraitsTest extends CodegenTestCase {
public void testSimple () throws Exception {
blackBoxFile("traits/simple.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testWithRequired () throws Exception {
blackBoxFile("traits/withRequired.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testMultiple () throws Exception {
diff --git a/compiler/tests/org/jetbrains/jet/codegen/TypeInfoTest.java b/compiler/tests/org/jetbrains/jet/codegen/TypeInfoTest.java
index 2abfd9db28e..1ce4e56d3c8 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/TypeInfoTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/TypeInfoTest.java
@@ -65,7 +65,7 @@ public class TypeInfoTest extends CodegenTestCase {
if (true) return;
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
assertFalse((Boolean) foo.invoke(null));
}
@@ -116,7 +116,7 @@ public class TypeInfoTest extends CodegenTestCase {
public void testClassObjectInTypeInfo() throws Exception {
loadFile();
- System.out.println(generateToText());
+// System.out.println(generateToText());
Method foo = generateFunction();
JetObject jetObject = (JetObject) foo.invoke(null);
TypeInfo> typeInfo = jetObject.getTypeInfo();
@@ -135,12 +135,12 @@ public class TypeInfoTest extends CodegenTestCase {
public void testKt259() throws Exception {
blackBoxFile("regressions/kt259.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
public void testInner() throws Exception {
blackBoxFile("typeInfo/inner.jet");
- System.out.println(generateToText());
+// System.out.println(generateToText());
}
}
diff --git a/compiler/tests/org/jetbrains/jet/codegen/VarArgTest.java b/compiler/tests/org/jetbrains/jet/codegen/VarArgTest.java
index a71dacad1af..62fbe452833 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/VarArgTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/VarArgTest.java
@@ -9,7 +9,7 @@ import java.lang.reflect.Method;
public class VarArgTest extends CodegenTestCase {
public void testStringArray () throws InvocationTargetException, IllegalAccessException {
loadText("fun test(vararg ts: String) = ts");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
String[] args = {"mama", "papa"};
assertTrue(args == main.invoke(null, new Object[]{ args } ));
@@ -17,7 +17,7 @@ public class VarArgTest extends CodegenTestCase {
public void testIntArray () throws InvocationTargetException, IllegalAccessException {
loadText("fun test(vararg ts: Int) = ts");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
int[] args = {3, 4};
assertTrue(args == main.invoke(null, new Object[]{ args }));
@@ -25,7 +25,7 @@ public class VarArgTest extends CodegenTestCase {
public void testIntArrayKotlinNoArgs () throws InvocationTargetException, IllegalAccessException {
loadText("fun test() = testf(); fun testf(vararg ts: Int) = ts");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Object res = main.invoke(null);
assertTrue(((int[])res).length == 0);
@@ -33,8 +33,9 @@ public class VarArgTest extends CodegenTestCase {
public void testIntArrayKotlin () throws InvocationTargetException, IllegalAccessException {
loadText("fun test() = testf(239, 7); fun testf(vararg ts: Int) = ts");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
+ System.out.println(main.toString());
Object res = main.invoke(null);
assertTrue(((int[])res).length == 2);
assertTrue(((int[])res)[0] == 239);
@@ -43,7 +44,7 @@ public class VarArgTest extends CodegenTestCase {
public void testNullableIntArrayKotlin () throws InvocationTargetException, IllegalAccessException {
loadText("fun test() = testf(239.byt, 7.byt); fun testf(vararg ts: Byte?) = ts");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Object res = main.invoke(null);
assertTrue(((Byte[])res).length == 2);
@@ -53,7 +54,7 @@ public class VarArgTest extends CodegenTestCase {
public void testIntArrayKotlinObj () throws InvocationTargetException, IllegalAccessException {
loadText("fun test() = testf(\"239\"); fun testf(vararg ts: String) = ts");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Object res = main.invoke(null);
assertTrue(((String[])res).length == 1);
@@ -62,7 +63,7 @@ public class VarArgTest extends CodegenTestCase {
public void testArrayT () throws InvocationTargetException, IllegalAccessException {
loadText("fun test() = _array(2, 4); fun _array(vararg elements : T) = elements");
- System.out.println(generateToText());
+// System.out.println(generateToText());
final Method main = generateFunction();
Object res = main.invoke(null);
assertTrue(((Integer[])res).length == 2);