Minor, use incrementType in for-progression codegen

This doesn't fix anything, just makes it easier to figure out values of what
types are used where. Progression increment is of its own type, which may be
different from asmElementType in case of Byte, Char, Short progressions
This commit is contained in:
Alexander Udalov
2013-06-20 20:14:52 +04:00
parent 980e409768
commit 53cc582040
4 changed files with 16 additions and 4 deletions
@@ -1068,12 +1068,12 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
v.load(loopParameterVar, asmElementType);
v.load(endVar, asmElementType);
v.load(incrementVar, asmElementType);
v.load(incrementVar, incrementType);
Label negativeIncrement = new Label();
Label afterIf = new Label();
if (asmElementType.getSort() == Type.DOUBLE) {
if (incrementType.getSort() == Type.DOUBLE) {
v.dconst(0.0);
}
else {
@@ -1100,7 +1100,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
v.load(loopParameterVar, asmElementType);
v.load(endVar, asmElementType);
v.load(incrementVar, asmElementType);
v.load(incrementVar, incrementType);
Label negativeIncrement = new Label();
Label afterIf = new Label();
@@ -0,0 +1,7 @@
fun box(): String {
for (element in 5.toByte()..1.toByte() step 255) {
return "Fail: iterating over an empty progression, element: $element"
}
return "OK"
}
@@ -403,6 +403,11 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/boxWithStdlib/ranges"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("forByteProgressionWithIntIncrement.kt")
public void testForByteProgressionWithIntIncrement() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/forByteProgressionWithIntIncrement.kt");
}
@TestMetadata("multiAssignmentIterationOverIntRange.kt")
public void testMultiAssignmentIterationOverIntRange() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/ranges/multiAssignmentIterationOverIntRange.kt");
@@ -162,7 +162,7 @@ public class JetResolveTestGenerated extends AbstractResolveTest {
public void testAllFilesPresentInCandidatesPriority() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/resolve/candidatesPriority"), Pattern.compile("^(.+)\\.resolve$"), true);
}
@TestMetadata("classObjectOuterResolve.resolve")
public void testClassObjectOuterResolve() throws Exception {
doTest("compiler/testData/resolve/candidatesPriority/classObjectOuterResolve.resolve");