KT-24156 Do not optimize for-loops over Strings with custom iterator
'fun CharSequence.iterator()' is an extension function, so one can overload it with custom implementation. Other "predefined" containers such as arrays and ranges have member 'fun iterator()', so these containers are not affected. Check that 'iterator' call corresponds to an extension function 'iterator' defined in package 'kotlin.text' with a receiver of type 'kotlin.CharSequence'. #KT-24156 Fixed
This commit is contained in:
+5
@@ -15480,6 +15480,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/ranges/forInStringVarUpdatedInLoopBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInStringWithCustomIterator.kt")
|
||||
public void testForInStringWithCustomIterator() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/forInStringWithCustomIterator.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forIntRange.kt")
|
||||
public void testForIntRange() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/ranges/forIntRange.kt");
|
||||
|
||||
Reference in New Issue
Block a user