Multi-declarations supported in all flavours of for loops

(KT-2635 Support iteration with multiple range variable in JVM back-end)
 #KT-2635 Fixed
This commit is contained in:
Andrey Breslav
2012-08-31 12:32:07 +04:00
parent f1c4ab7188
commit ce1320bab3
46 changed files with 1603 additions and 74 deletions
@@ -411,23 +411,39 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
@Override
public StackValue visitForExpression(JetForExpression expression, StackValue receiver) {
final JetExpression loopRange = expression.getLoopRange();
final JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, loopRange);
assert expressionType != null;
Type loopRangeType = asmType(expressionType);
if (loopRangeType.getSort() == Type.ARRAY) {
generateForLoop(new ForInArrayLoopGenerator(expression));
public StackValue visitForExpression(JetForExpression forExpression, StackValue receiver) {
// Is it a "1..2" or so
RangeCodegenUtil.BinaryCall binaryCall = RangeCodegenUtil.getRangeAsBinaryCall(forExpression);
if (binaryCall != null) {
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(RESOLVED_CALL, binaryCall.op);
assert resolvedCall != null;
CallableDescriptor rangeTo = resolvedCall.getResultingDescriptor();
if (RangeCodegenUtil.isOptimizableRangeTo(rangeTo)
// todo: currently, only Int ranges are supported, but all primitives must be optimized
&& RangeCodegenUtil.isIntRange(rangeTo.getReturnType())
) {
generateForLoop(new ForInIntRangeLiteralLoopGenerator(forExpression, binaryCall, resolvedCall));
return StackValue.none();
}
}
final JetExpression loopRange = forExpression.getLoopRange();
final JetType loopRangeType = bindingContext.get(BindingContext.EXPRESSION_TYPE, loopRange);
assert loopRangeType != null;
Type asmLoopRangeType = asmType(loopRangeType);
if (asmLoopRangeType.getSort() == Type.ARRAY) {
generateForLoop(new ForInArrayLoopGenerator(forExpression));
return StackValue.none();
}
else {
final DeclarationDescriptor descriptor = expressionType.getConstructor().getDeclarationDescriptor();
if (isClass(descriptor, "IntRange")) { // TODO IntRange subclasses (now IntRange is final)
new ForInRangeLoopGenerator(expression, loopRangeType).invoke();
// todo: Only IntRange optimized so far
if (RangeCodegenUtil.isIntRange(loopRangeType)) {
generateForLoop(new ForInIntRangeInstanceLoopGenerator(forExpression));
return StackValue.none();
}
generateForLoop(new IteratorForLoopGenerator(expression));
generateForLoop(new IteratorForLoopGenerator(forExpression));
return StackValue.none();
}
}
@@ -780,84 +796,135 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
}
private class ForInRangeLoopGenerator extends IntrinsicForLoopGenerator {
private int myCountVar;
private int myDeltaVar;
private int myIndexVar;
private class ForInIntRangeLiteralLoopGenerator extends AbstractForLoopGenerator {
private final RangeCodegenUtil.BinaryCall rangeCall;
private final ResolvedCall<? extends CallableDescriptor> resolvedCall;
private Type asmElementType;
private int indexVar;
private int lastVar;
public ForInRangeLoopGenerator(JetForExpression expression, Type loopRangeType) {
super(expression, loopRangeType);
private ForInIntRangeLiteralLoopGenerator(
@NotNull JetForExpression forExpression,
@NotNull RangeCodegenUtil.BinaryCall rangeCall,
ResolvedCall<? extends CallableDescriptor> resolvedCall
) {
super(forExpression);
this.rangeCall = rangeCall;
this.resolvedCall = resolvedCall;
}
@Override
protected void generatePrologue() {
myIndexVar = lookupLocalIndex(parameterDescriptor);
myCountVar = myFrameMap.enterTemp(Type.INT_TYPE);
myDeltaVar = myFrameMap.enterTemp(Type.INT_TYPE);
if (isIntRangeExpr(expression.getLoopRange())) {
JetBinaryExpression rangeExpression = (JetBinaryExpression) expression.getLoopRange();
//noinspection ConstantConditions
gen(rangeExpression.getLeft(), Type.INT_TYPE);
v.store(myIndexVar, Type.INT_TYPE);
gen(rangeExpression.getRight(), Type.INT_TYPE);
v.store(myCountVar, Type.INT_TYPE);
public void beforeLoop() {
JetType elementType = RangeCodegenUtil.getPrimitiveRangeElementType(resolvedCall.getResultingDescriptor().getReturnType());
assert elementType != null;
asmElementType = asmType(elementType);
v.load(myCountVar, Type.INT_TYPE);
v.load(myIndexVar, Type.INT_TYPE);
v.sub(Type.INT_TYPE);
v.iconst(1);
v.add(Type.INT_TYPE);
v.store(myCountVar, Type.INT_TYPE);
indexVar = myFrameMap.enterTemp(asmElementType);
gen(rangeCall.left, asmElementType);
v.store(indexVar, asmElementType);
v.load(myCountVar, Type.INT_TYPE);
v.iflt(end);
v.iconst(1);
v.store(myDeltaVar, Type.INT_TYPE);
}
else {
gen(expression.getLoopRange(), loopRangeType);
v.dup();
v.dup();
v.invokevirtual("jet/IntRange", "getStart", "()I");
v.store(myIndexVar, Type.INT_TYPE);
v.invokevirtual("jet/IntRange", "getSize", "()I");
v.store(myCountVar, Type.INT_TYPE);
v.invokevirtual("jet/IntRange", "getIsReversed", "()Z");
Label down = new Label();
v.ifne(down);
v.iconst(1);
Label initEnd = new Label();
v.goTo(initEnd);
v.mark(down);
v.iconst(-1);
v.mark(initEnd);
v.store(myDeltaVar, Type.INT_TYPE);
}
lastVar = myFrameMap.enterTemp(asmElementType);
gen(rangeCall.right, asmElementType);
v.store(lastVar, asmElementType);
}
@Override
protected void generateCondition(Type asmParamType, Label end) {
v.load(myCountVar, Type.INT_TYPE);
v.ifeq(end);
public void conditionAndJump(@NotNull Label loopExit) {
v.load(indexVar, asmElementType);
v.load(lastVar, asmElementType);
v.ificmpgt(loopExit);
}
@Override
protected void generateIncrement() {
v.load(myIndexVar, Type.INT_TYPE);
v.load(myDeltaVar, Type.INT_TYPE);
protected void assignToLoopParameter(int parameterIndex) {
// todo: don't create a temp variable if this is not a multi-decl for
v.load(indexVar, asmElementType);
v.store(parameterIndex, asmElementType);
}
@Override
public void afterBody() {
v.iinc(indexVar, 1);
super.afterBody();
}
@Override
public void afterLoop() {
myFrameMap.leaveTemp(asmElementType); // lastVar
myFrameMap.leaveTemp(asmElementType); // indexVar
}
}
private class ForInIntRangeInstanceLoopGenerator extends AbstractForLoopGenerator {
private int indexVar;
private int countVar;
private int deltaVar;
private ForInIntRangeInstanceLoopGenerator(
@NotNull JetForExpression forExpression
) {
super(forExpression);
}
@Override
public void beforeLoop() {
JetType loopRangeType = bindingContext.get(EXPRESSION_TYPE, forExpression.getLoopRange());
assert loopRangeType != null;
Type asmLoopRangeType = asmType(loopRangeType);
gen(forExpression.getLoopRange(), asmLoopRangeType);
v.dup();
v.dup();
indexVar = myFrameMap.enterTemp(Type.INT_TYPE);
v.invokevirtual(JET_INT_RANGE_TYPE.getInternalName(), "getStart", "()I");
v.store(indexVar, Type.INT_TYPE);
countVar = myFrameMap.enterTemp(Type.INT_TYPE);
v.invokevirtual(JET_INT_RANGE_TYPE.getInternalName(), "getSize", "()I");
v.store(countVar, Type.INT_TYPE);
deltaVar = myFrameMap.enterTemp(Type.INT_TYPE);
v.invokevirtual(JET_INT_RANGE_TYPE.getInternalName(), "getIsReversed", "()Z");
Label down = new Label();
v.ifne(down);
v.iconst(1);
Label initEnd = new Label();
v.goTo(initEnd);
v.mark(down);
v.iconst(-1);
v.mark(initEnd);
v.store(deltaVar, Type.INT_TYPE);
}
@Override
public void conditionAndJump(@NotNull Label loopExit) {
v.load(countVar, Type.INT_TYPE);
v.ifeq(loopExit);
}
@Override
protected void assignToLoopParameter(int parameterIndex) {
// todo: no temp var when this is not a multi-declaration for-loop
v.load(indexVar, Type.INT_TYPE);
v.store(parameterIndex, Type.INT_TYPE);
}
@Override
public void afterBody() {
v.load(indexVar, Type.INT_TYPE);
v.load(deltaVar, Type.INT_TYPE);
v.add(Type.INT_TYPE);
v.store(myIndexVar, Type.INT_TYPE);
v.iinc(myCountVar, -1);
v.store(indexVar, Type.INT_TYPE);
v.iinc(countVar, -1);
super.afterBody();
}
@Override
protected void cleanupTemp() {
myFrameMap.leaveTemp(Type.INT_TYPE);
myFrameMap.leaveTemp(Type.INT_TYPE);
public void afterLoop() {
myFrameMap.leaveTemp(Type.INT_TYPE); // deltaVar
myFrameMap.leaveTemp(Type.INT_TYPE); // countVar
myFrameMap.leaveTemp(Type.INT_TYPE); // indexVar
}
}
@@ -0,0 +1,110 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.codegen;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
import java.util.List;
/**
* @author abreslav
*/
public class RangeCodegenUtil {
private static final ImmutableMap<String, JetType> RANGE_TO_ELEMENT_TYPE = ImmutableMap.<String, JetType>builder()
.put("ByteRange", JetStandardLibrary.getInstance().getByteType())
.put("ShortRange", JetStandardLibrary.getInstance().getShortType())
.put("IntRange", JetStandardLibrary.getInstance().getIntType())
.put("LongRange", JetStandardLibrary.getInstance().getLongType())
.put("FloatRange", JetStandardLibrary.getInstance().getFloatType())
.put("DoubleRange", JetStandardLibrary.getInstance().getDoubleType())
.put("CharRange", JetStandardLibrary.getInstance().getCharType())
.build();
private RangeCodegenUtil() {}
public static boolean isIntRange(JetType rangeType) {
return !rangeType.isNullable()
&& JetStandardLibrary.getInstance().getIntType().equals(getPrimitiveRangeElementType(rangeType));
}
@Nullable
public static BinaryCall getRangeAsBinaryCall(@NotNull JetForExpression forExpression) {
JetExpression rangeExpression = forExpression.getLoopRange();
assert rangeExpression != null;
JetExpression loopRange = JetPsiUtil.deparenthesize(rangeExpression);
if (loopRange instanceof JetQualifiedExpression) {
// a.rangeTo(b)
JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) loopRange;
JetExpression selector = qualifiedExpression.getSelectorExpression();
if (selector instanceof JetCallExpression) {
JetCallExpression callExpression = (JetCallExpression) selector;
List<? extends ValueArgument> arguments = callExpression.getValueArguments();
if (arguments.size() == 1) {
return new BinaryCall(qualifiedExpression.getReceiverExpression(), callExpression.getCalleeExpression(),
arguments.get(0).getArgumentExpression());
}
}
}
else if (loopRange instanceof JetBinaryExpression) {
// a rangeTo b
// a .. b
JetBinaryExpression binaryExpression = (JetBinaryExpression) loopRange;
return new BinaryCall(binaryExpression.getLeft(), binaryExpression.getOperationReference(), binaryExpression.getRight());
}
return null;
}
@Nullable
public static JetType getPrimitiveRangeElementType(JetType rangeType) {
ClassifierDescriptor declarationDescriptor = rangeType.getConstructor().getDeclarationDescriptor();
assert declarationDescriptor != null;
if (declarationDescriptor != JetStandardLibrary.getInstance().getLibraryScope().getClassifier(declarationDescriptor.getName())) {
// Must be a standard library class
return null;
}
return RANGE_TO_ELEMENT_TYPE.get(declarationDescriptor.getName().getName());
}
public static boolean isOptimizableRangeTo(CallableDescriptor rangeTo) {
if ("rangeTo".equals(rangeTo.getName().getName())) {
if (CodegenUtil.isPrimitiveNumberClassDescriptor(rangeTo.getContainingDeclaration())) {
return true;
}
}
return false;
}
public static class BinaryCall {
public final JetExpression left;
public final JetExpression op;
public final JetExpression right;
private BinaryCall(JetExpression left, JetExpression op, JetExpression right) {
this.left = left;
this.op = op;
this.right = right;
}
}
}
@@ -0,0 +1,19 @@
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(l : java.util.ArrayList<Long>): String {
var s = ""
for ((a, b) in l) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val l = java.util.ArrayList<Long>()
l.add(0)
l.add(1)
l.add(2)
val s = doTest(l)
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,19 @@
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(l : java.util.ArrayList<Long>): String {
var s = ""
for ((a, b) in l) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val l = java.util.ArrayList<Long>()
l.add(0)
l.add(1)
l.add(2)
val s = doTest(l)
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,21 @@
class M {
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(l : java.util.ArrayList<Long>): String {
var s = ""
for ((a, b) in l) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val l = java.util.ArrayList<Long>()
l.add(0)
l.add(1)
l.add(2)
val s = M().doTest(l)
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,21 @@
class M {
fun Long.component1() = this + 1
fun Long.component2() = this + 2
}
fun M.doTest(l : java.util.ArrayList<Long>): String {
var s = ""
for ((a, b) in l) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val l = java.util.ArrayList<Long>()
l.add(0)
l.add(1)
l.add(2)
val s = M().doTest(l)
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,38 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun component1() = i + 1
fun component2() = i + 2
fun rangeTo(c: C) = Range(this, c)
}
fun doTest(): String {
var s = ""
for ((a, b) in C(0)..C(2)) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
fun main(args: Array<String>) {
println(box())
}
@@ -0,0 +1,34 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun rangeTo(c: C) = Range(this, c)
}
fun C.component1() = i + 1
fun C.component2() = i + 2
fun doTest(): String {
var s = ""
for ((a, b) in C(0)..C(2)) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,38 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun rangeTo(c: C) = Range(this, c)
}
class M {
fun C.component1() = i + 1
fun C.component2() = i + 2
fun doTest(): String {
var s = ""
for ((a, b) in C(0)..C(2)) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,41 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun rangeTo(c: C) = Range(this, c)
}
class M {
fun C.component1() = i + 1
fun C.component2() = i + 2
}
fun M.doTest(): String {
var s = ""
for ((a, b) in C(0)..C(2)) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
fun main(args: Array<String>) {
println(box())
}
@@ -0,0 +1,34 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun component1() = i + 1
fun component2() = i + 2
fun rangeTo(c: C) = Range(this, c)
}
fun doTest(): String {
var s = ""
for ((a, b) in C(0)..C(2)) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,38 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun component1() = i + 1
fun component2() = i + 2
fun rangeTo(c: C) = Range(this, c)
}
fun doTest(): String {
var s = ""
for ((a, b) in C(0) rangeTo C(2)) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
fun main(args: Array<String>) {
println(box())
}
@@ -0,0 +1,34 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun rangeTo(c: C) = Range(this, c)
}
fun C.component1() = i + 1
fun C.component2() = i + 2
fun doTest(): String {
var s = ""
for ((a, b) in C(0) rangeTo C(2)) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,38 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun rangeTo(c: C) = Range(this, c)
}
class M {
fun C.component1() = i + 1
fun C.component2() = i + 2
fun doTest(): String {
var s = ""
for ((a, b) in C(0) rangeTo C(2)) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,41 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun rangeTo(c: C) = Range(this, c)
}
class M {
fun C.component1() = i + 1
fun C.component2() = i + 2
}
fun M.doTest(): String {
var s = ""
for ((a, b) in C(0) rangeTo C(2)) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
fun main(args: Array<String>) {
println(box())
}
@@ -0,0 +1,34 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun component1() = i + 1
fun component2() = i + 2
fun rangeTo(c: C) = Range(this, c)
}
fun doTest(): String {
var s = ""
for ((a, b) in C(0) rangeTo C(2)) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Int.component1() = this + 1
fun Int.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0 rangeTo 2) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Int.component1() = this + 1
fun Int.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0 rangeTo 2) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Int.component1() = this + 1
fun Int.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0 rangeTo 2) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Int.component1() = this + 1
fun Int.component2() = this + 2
}
fun M.doTest(): String {
var s = ""
for ((a, b) in 0 rangeTo 2) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.toLong() rangeTo 2.toLong()) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.toLong() rangeTo 2.toLong()) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.toLong() rangeTo 2.toLong()) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Long.component1() = this + 1
fun Long.component2() = this + 2
}
fun M.doTest(): String {
var s = ""
for ((a, b) in 0.toLong() rangeTo 2.toLong()) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,38 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun component1() = i + 1
fun component2() = i + 2
fun rangeTo(c: C) = Range(this, c)
}
fun doTest(): String {
var s = ""
for ((a, b) in C(0).rangeTo(C(2))) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
fun main(args: Array<String>) {
println(box())
}
@@ -0,0 +1,34 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun rangeTo(c: C) = Range(this, c)
}
fun C.component1() = i + 1
fun C.component2() = i + 2
fun doTest(): String {
var s = ""
for ((a, b) in C(0).rangeTo(C(2))) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,38 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun rangeTo(c: C) = Range(this, c)
}
class M {
fun C.component1() = i + 1
fun C.component2() = i + 2
fun doTest(): String {
var s = ""
for ((a, b) in C(0).rangeTo(C(2))) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,41 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun rangeTo(c: C) = Range(this, c)
}
class M {
fun C.component1() = i + 1
fun C.component2() = i + 2
}
fun M.doTest(): String {
var s = ""
for ((a, b) in C(0).rangeTo(C(2))) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
fun main(args: Array<String>) {
println(box())
}
@@ -0,0 +1,34 @@
class Range(val from : C, val to: C) {
fun iterator() = It(from, to)
}
class It(val from: C, val to: C) {
var c = from.i
fun next(): C {
val next = C(c)
c++
return next
}
fun hasNext(): Boolean = c <= to.i
}
class C(val i : Int) {
fun component1() = i + 1
fun component2() = i + 2
fun rangeTo(c: C) = Range(this, c)
}
fun doTest(): String {
var s = ""
for ((a, b) in C(0).rangeTo(C(2))) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Int.component1() = this + 1
fun Int.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.rangeTo(2)) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Int.component1() = this + 1
fun Int.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.rangeTo(2)) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Int.component1() = this + 1
fun Int.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.rangeTo(2)) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Int.component1() = this + 1
fun Int.component2() = this + 2
}
fun M.doTest(): String {
var s = ""
for ((a, b) in 0.rangeTo(2)) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,23 @@
fun f(l : Long) {
l rangeTo l
}
fun box(): String {
return "OK"
}
//fun Long.component1() = this + 1
//fun Long.component2() = this + 2
//
//fun doTest(): String {
// var s = ""
// for ((a, b) in 0.toLong().rangeTo(2.toLong())) {
// s += "$a:$b;"
// }
// return s
//}
//
//fun box(): String {
// val s = doTest()
// return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
//}
@@ -0,0 +1,15 @@
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.toLong().rangeTo(2.toLong())) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.toLong().rangeTo(2.toLong())) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Long.component1() = this + 1
fun Long.component2() = this + 2
}
fun M.doTest(): String {
var s = ""
for ((a, b) in 0.toLong().rangeTo(2.toLong())) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Int.component1() = this + 1
fun Int.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0..2) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Int.component1() = this + 1
fun Int.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0..2) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Int.component1() = this + 1
fun Int.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0..2) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Int.component1() = this + 1
fun Int.component2() = this + 2
}
fun M.doTest(): String {
var s = ""
for ((a, b) in 0..2) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.toLong()..2.toLong()) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,15 @@
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.toLong()..2.toLong()) {
s += {"$a:$b;"}()
}
return s
}
fun box(): String {
val s = doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Long.component1() = this + 1
fun Long.component2() = this + 2
fun doTest(): String {
var s = ""
for ((a, b) in 0.toLong()..2.toLong()) {
s += "$a:$b;"
}
return s
}
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -0,0 +1,17 @@
class M {
fun Long.component1() = this + 1
fun Long.component2() = this + 2
}
fun M.doTest(): String {
var s = ""
for ((a, b) in 0.toLong()..2.toLong()) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val s = M().doTest()
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}
@@ -212,13 +212,338 @@ public class MultiDeclTestGenerated extends AbstractMultiDeclTestCase {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forIterator/MultiDeclForValCaptured.kt");
}
@TestMetadata("compiler/testData/codegen/multiDecl/forIterator/longIterator")
public static class LongIterator extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInLongIterator() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forIterator/longIterator"), "kt", false);
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentExtensionsValCaptured.kt")
public void testMultiDeclForComponentExtensionsValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forIterator/longIterator/MultiDeclForComponentExtensionsValCaptured.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forIterator/longIterator/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
}
public static Test innerSuite() {
TestSuite suite = new TestSuite("ForIterator");
suite.addTestSuite(ForIterator.class);
suite.addTestSuite(LongIterator.class);
return suite;
}
}
@TestMetadata("compiler/testData/codegen/multiDecl/forRange")
public static class ForRange extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInForRange() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forRange"), "kt", false);
}
@TestMetadata("MultiDeclFor.kt")
public void testMultiDeclFor() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/MultiDeclFor.kt");
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
@TestMetadata("MultiDeclForValCaptured.kt")
public void testMultiDeclForValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/MultiDeclForValCaptured.kt");
}
@TestMetadata("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo")
public static class ExplicitRangeTo extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInExplicitRangeTo() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo"), "kt", false);
}
@TestMetadata("MultiDeclFor.kt")
public void testMultiDeclFor() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/MultiDeclFor.kt");
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
@TestMetadata("MultiDeclForValCaptured.kt")
public void testMultiDeclForValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/MultiDeclForValCaptured.kt");
}
@TestMetadata("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/int")
public static class Int extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInInt() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/int"), "kt", false);
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentExtensionsValCaptured.kt")
public void testMultiDeclForComponentExtensionsValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentExtensionsValCaptured.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
}
@TestMetadata("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/long")
public static class Long extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInLong() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/long"), "kt", false);
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentExtensionsValCaptured.kt")
public void testMultiDeclForComponentExtensionsValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentExtensionsValCaptured.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeTo/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
}
public static Test innerSuite() {
TestSuite suite = new TestSuite("ExplicitRangeTo");
suite.addTestSuite(ExplicitRangeTo.class);
suite.addTestSuite(Int.class);
suite.addTestSuite(Long.class);
return suite;
}
}
@TestMetadata("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot")
public static class ExplicitRangeToWithDot extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInExplicitRangeToWithDot() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot"), "kt", false);
}
@TestMetadata("MultiDeclFor.kt")
public void testMultiDeclFor() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/MultiDeclFor.kt");
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
@TestMetadata("MultiDeclForValCaptured.kt")
public void testMultiDeclForValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/MultiDeclForValCaptured.kt");
}
@TestMetadata("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/int")
public static class Int extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInInt() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/int"), "kt", false);
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentExtensionsValCaptured.kt")
public void testMultiDeclForComponentExtensionsValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentExtensionsValCaptured.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
}
@TestMetadata("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/long")
public static class Long extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInLong() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/long"), "kt", false);
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentExtensionsValCaptured.kt")
public void testMultiDeclForComponentExtensionsValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentExtensionsValCaptured.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/explicitRangeToWithDot/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
}
public static Test innerSuite() {
TestSuite suite = new TestSuite("ExplicitRangeToWithDot");
suite.addTestSuite(ExplicitRangeToWithDot.class);
suite.addTestSuite(Int.class);
suite.addTestSuite(Long.class);
return suite;
}
}
@TestMetadata("compiler/testData/codegen/multiDecl/forRange/int")
public static class Int extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInInt() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forRange/int"), "kt", false);
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/int/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentExtensionsValCaptured.kt")
public void testMultiDeclForComponentExtensionsValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/int/MultiDeclForComponentExtensionsValCaptured.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/int/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/int/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
}
@TestMetadata("compiler/testData/codegen/multiDecl/forRange/long")
public static class Long extends AbstractMultiDeclTestCase {
public void testAllFilesPresentInLong() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractMultiDeclTestCase", new File("compiler/testData/codegen/multiDecl/forRange/long"), "kt", false);
}
@TestMetadata("MultiDeclForComponentExtensions.kt")
public void testMultiDeclForComponentExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/long/MultiDeclForComponentExtensions.kt");
}
@TestMetadata("MultiDeclForComponentExtensionsValCaptured.kt")
public void testMultiDeclForComponentExtensionsValCaptured() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/long/MultiDeclForComponentExtensionsValCaptured.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensions.kt")
public void testMultiDeclForComponentMemberExtensions() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/long/MultiDeclForComponentMemberExtensions.kt");
}
@TestMetadata("MultiDeclForComponentMemberExtensionsInExtensionFunction.kt")
public void testMultiDeclForComponentMemberExtensionsInExtensionFunction() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/multiDecl/forRange/long/MultiDeclForComponentMemberExtensionsInExtensionFunction.kt");
}
}
public static Test innerSuite() {
TestSuite suite = new TestSuite("ForRange");
suite.addTestSuite(ForRange.class);
suite.addTest(ExplicitRangeTo.innerSuite());
suite.addTest(ExplicitRangeToWithDot.innerSuite());
suite.addTestSuite(Int.class);
suite.addTestSuite(Long.class);
return suite;
}
}
public static Test suite() {
TestSuite suite = new TestSuite("MultiDeclTestGenerated");
suite.addTestSuite(MultiDeclTestGenerated.class);
suite.addTest(ForArray.innerSuite());
suite.addTestSuite(ForIterator.class);
suite.addTest(ForIterator.innerSuite());
suite.addTest(ForRange.innerSuite());
return suite;
}
}