Rework support of Iterator.iterator optimization in ForLoopsLowering
- Fix the predicate used for finding the member function `next`: check that there's no extension receiver parameter, don't filter out abstract functions. - Do not copy iterator expression, instead change the type in all references to the iterator variable. - Fix some style issues. #KT-47171 Fixed
This commit is contained in:
committed by
Alexander Udalov
parent
1b776bd5b6
commit
157db778fd
+34
-16
@@ -9335,6 +9335,40 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/controlStructures/forInIterator")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ForInIterator {
|
||||
@Test
|
||||
@TestMetadata("abstractNext.kt")
|
||||
public void testAbstractNext() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/forInIterator/abstractNext.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInForInIterator() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/controlStructures/forInIterator"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primitiveIterator.kt")
|
||||
public void testPrimitiveIterator() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/forInIterator/primitiveIterator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("uintIterator.kt")
|
||||
public void testUintIterator() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/forInIterator/uintIterator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unrelatedExtensionFunctionNext.kt")
|
||||
public void testUnrelatedExtensionFunctionNext() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/forInIterator/unrelatedExtensionFunctionNext.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/controlStructures/forInSequenceWithIndex")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -17266,22 +17300,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/forLoop")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ForLoop {
|
||||
@Test
|
||||
public void testAllFilesPresentInForLoop() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/forLoop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forInIterator.kt")
|
||||
public void testForInIterator() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/forLoop/forInIterator.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/box/fullJdk")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user