KT-3820 VerifyError when invoking intrinsic for range obtained from collection
#KT-3820 fixed
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ public class PropertyOfProgressionOrRange implements IntrinsicMethod {
|
||||
JvmClassName wrapperClass = JvmPrimitiveType.getByAsmType(expectedType).getWrapper();
|
||||
String getterName = PropertyCodegen.getterName(propertyName);
|
||||
|
||||
receiver.put(AsmTypeConstants.OBJECT_TYPE, v);
|
||||
receiver.put(receiver.type, v);
|
||||
v.invokevirtual(ownerInternalName, getterName, "()" + wrapperClass.getDescriptor());
|
||||
StackValue.coerce(wrapperClass.getAsmType(), expectedType, v);
|
||||
return StackValue.onStack(expectedType);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class StringGetChar implements IntrinsicMethod {
|
||||
@NotNull GenerationState state
|
||||
) {
|
||||
if (receiver != null) {
|
||||
receiver.put(AsmTypeConstants.OBJECT_TYPE, v);
|
||||
receiver.put(receiver.type, v);
|
||||
}
|
||||
if (arguments != null) {
|
||||
codegen.gen(arguments.get(0)).put(Type.INT_TYPE, v);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class StringLength implements IntrinsicMethod {
|
||||
StackValue receiver,
|
||||
@NotNull GenerationState state
|
||||
) {
|
||||
receiver.put(AsmTypeConstants.OBJECT_TYPE, v);
|
||||
receiver.put(receiver.type, v);
|
||||
v.invokeinterface("java/lang/CharSequence", "length", "()I");
|
||||
return StackValue.onStack(Type.INT_TYPE);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
fun box(): String {
|
||||
val list = java.util.ArrayList<IntRange>()
|
||||
list.add(1..3)
|
||||
list[0].start
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun box(): String {
|
||||
val list = java.util.ArrayList<String>()
|
||||
list.add("0")
|
||||
list[0][0]
|
||||
list[0].length
|
||||
return "OK"
|
||||
}
|
||||
@@ -2455,6 +2455,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest("compiler/testData/codegen/box/intrinsics/longRangeWithExplicitDot.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rangeFromCollection.kt")
|
||||
public void testRangeFromCollection() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/intrinsics/rangeFromCollection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("stringFromCollection.kt")
|
||||
public void testStringFromCollection() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/intrinsics/stringFromCollection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("tostring.kt")
|
||||
public void testTostring() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/intrinsics/tostring.kt");
|
||||
|
||||
Reference in New Issue
Block a user