Maintain proper evaluation order for 'a in x .. y'

As of Kotlin 1.0 and 1.1, expression 'a in x .. y' is considered
equivalent to 'x.rangeTo(y).a', and should be evaluated in the following
order:
1. x
2. y
3. a
4. compare x with a
5. compare y with a (if needed)
This commit is contained in:
Dmitry Petrov
2017-07-07 12:31:23 +03:00
parent fc3e9318d9
commit 905a16e1df
14 changed files with 298 additions and 44 deletions
@@ -13177,6 +13177,30 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/contains"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("evaluationOrderForCollection.kt")
public void testEvaluationOrderForCollection() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/evaluationOrderForCollection.kt");
doTest(fileName);
}
@TestMetadata("evaluationOrderForComparableRange.kt")
public void testEvaluationOrderForComparableRange() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/evaluationOrderForComparableRange.kt");
doTest(fileName);
}
@TestMetadata("evaluationOrderForDownTo.kt")
public void testEvaluationOrderForDownTo() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/evaluationOrderForDownTo.kt");
doTest(fileName);
}
@TestMetadata("evaluationOrderForRangeLiteral.kt")
public void testEvaluationOrderForRangeLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/evaluationOrderForRangeLiteral.kt");
doTest(fileName);
}
@TestMetadata("inArray.kt")
public void testInArray() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inArray.kt");