Optimize rangeUntil operator in for-loops and contains

Newly added tests are basically copies of the existing tests on `until`.
Note that this operator is optimized for all backends, but the fact that
it's optimized is only checked for the JVM backend in bytecode text
tests.

 #KT-53330 Fixed
This commit is contained in:
Alexander Udalov
2022-12-09 14:57:22 +01:00
committed by Space Team
parent bc5acb5e9d
commit 28759a3ac3
17 changed files with 611 additions and 1 deletions
@@ -2772,6 +2772,70 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
}
}
@Nested
@TestMetadata("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil")
@TestDataPath("$PROJECT_ROOT")
public class ForInRangeUntil {
@Test
public void testAllFilesPresentInForInRangeUntil() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("forInRangeUntilChar.kt")
public void testForInRangeUntilChar() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil/forInRangeUntilChar.kt");
}
@Test
@TestMetadata("forInRangeUntilCharMaxValue.kt")
public void testForInRangeUntilCharMaxValue() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil/forInRangeUntilCharMaxValue.kt");
}
@Test
@TestMetadata("forInRangeUntilCharMinValue.kt")
public void testForInRangeUntilCharMinValue() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil/forInRangeUntilCharMinValue.kt");
}
@Test
@TestMetadata("forInRangeUntilInt.kt")
public void testForInRangeUntilInt() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil/forInRangeUntilInt.kt");
}
@Test
@TestMetadata("forInRangeUntilIntMaxValue.kt")
public void testForInRangeUntilIntMaxValue() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil/forInRangeUntilIntMaxValue.kt");
}
@Test
@TestMetadata("forInRangeUntilIntMinValue.kt")
public void testForInRangeUntilIntMinValue() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil/forInRangeUntilIntMinValue.kt");
}
@Test
@TestMetadata("forInRangeUntilLong.kt")
public void testForInRangeUntilLong() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil/forInRangeUntilLong.kt");
}
@Test
@TestMetadata("forInRangeUntilLongMaxValue.kt")
public void testForInRangeUntilLongMaxValue() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil/forInRangeUntilLongMaxValue.kt");
}
@Test
@TestMetadata("forInRangeUntilLongMinValue.kt")
public void testForInRangeUntilLongMinValue() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInRangeUntil/forInRangeUntilLongMinValue.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/bytecodeText/forLoop/forInRangeWithUpperBoundMinus1")
@TestDataPath("$PROJECT_ROOT")
@@ -5224,6 +5288,12 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/ranges/inOptimizableUnsignedRange.kt");
}
@Test
@TestMetadata("inRangeUntil.kt")
public void testInRangeUntil() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/ranges/inRangeUntil.kt");
}
@Test
@TestMetadata("inUntil.kt")
public void testInUntil() throws Exception {