[IR] Fix issue getting the length property from CharSequence bounded type parameter
Use the class of the subtype of CharSequence when available. When it is not (for type parameters bounded by CharSequence) call the CharSequence getter and 'get' method. Using the most specific type posible fixes the forInStringSpecialized test that expects the use of INVOKEVIRTUAL and not INVOKEINTERFACE. Add tests for the type parameter use.
This commit is contained in:
@@ -1677,6 +1677,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInCharSequence.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInCharSequenceTypeParameter.kt")
|
||||
public void testForInCharSequenceTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInDownToCharMinValue.kt")
|
||||
public void testForInDownToCharMinValue() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInDownToCharMinValue.kt");
|
||||
@@ -1890,6 +1895,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceIndices.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInCharSequenceTypeParameterIndices.kt")
|
||||
public void testForInCharSequenceTypeParameterIndices() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("forInCollectionImplicitReceiverIndices.kt")
|
||||
public void testForInCollectionImplicitReceiverIndices() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionImplicitReceiverIndices.kt");
|
||||
|
||||
Reference in New Issue
Block a user