Fix IteratorNext intrinsic to cast its dispatch receiver to
the expected type. ^KT-47741 Fixed.
This commit is contained in:
committed by
Alexander Udalov
parent
f83cc69379
commit
b51ff799cb
+6
@@ -3465,6 +3465,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47741.kt")
|
||||||
|
public void testKt47741() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/callableReference/function/kt47741.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("nestedConstructorFromClass.kt")
|
@TestMetadata("nestedConstructorFromClass.kt")
|
||||||
public void testNestedConstructorFromClass() throws Exception {
|
public void testNestedConstructorFromClass() throws Exception {
|
||||||
|
|||||||
+2
-2
@@ -33,8 +33,8 @@ object IteratorNext : IntrinsicMethod() {
|
|||||||
// If the array element type is unboxed primitive, do not unbox. Otherwise AsmUtil.unbox throws exception
|
// If the array element type is unboxed primitive, do not unbox. Otherwise AsmUtil.unbox throws exception
|
||||||
val type = if (AsmUtil.isBoxedPrimitiveType(signature.returnType)) AsmUtil.unboxType(signature.returnType) else signature.returnType
|
val type = if (AsmUtil.isBoxedPrimitiveType(signature.returnType)) AsmUtil.unboxType(signature.returnType) else signature.returnType
|
||||||
val newSignature = signature.newReturnType(type)
|
val newSignature = signature.newReturnType(type)
|
||||||
return IrIntrinsicFunction.create(expression, newSignature, context, AsmTypes.OBJECT_TYPE) {
|
val primitiveClassName = getKotlinPrimitiveClassName(type)
|
||||||
val primitiveClassName = getKotlinPrimitiveClassName(type)
|
return IrIntrinsicFunction.create(expression, newSignature, context, getPrimitiveIteratorType(primitiveClassName)) {
|
||||||
it.invokevirtual(
|
it.invokevirtual(
|
||||||
getPrimitiveIteratorType(primitiveClassName).internalName,
|
getPrimitiveIteratorType(primitiveClassName).internalName,
|
||||||
"next${primitiveClassName.asString()}",
|
"next${primitiveClassName.asString()}",
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// IGNORE_BACKEND: WASM
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val generateId = (1 .. Int.MAX_VALUE).iterator()::next
|
||||||
|
return if (generateId() == 1) "OK" else "FAIL"
|
||||||
|
}
|
||||||
+6
@@ -3465,6 +3465,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47741.kt")
|
||||||
|
public void testKt47741() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/callableReference/function/kt47741.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("nestedConstructorFromClass.kt")
|
@TestMetadata("nestedConstructorFromClass.kt")
|
||||||
public void testNestedConstructorFromClass() throws Exception {
|
public void testNestedConstructorFromClass() throws Exception {
|
||||||
|
|||||||
+6
@@ -3465,6 +3465,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47741.kt")
|
||||||
|
public void testKt47741() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/callableReference/function/kt47741.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("nestedConstructorFromClass.kt")
|
@TestMetadata("nestedConstructorFromClass.kt")
|
||||||
public void testNestedConstructorFromClass() throws Exception {
|
public void testNestedConstructorFromClass() throws Exception {
|
||||||
|
|||||||
+5
@@ -3027,6 +3027,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47741.kt")
|
||||||
|
public void testKt47741() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/callableReference/function/kt47741.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConstructorFromClass.kt")
|
@TestMetadata("nestedConstructorFromClass.kt")
|
||||||
public void testNestedConstructorFromClass() throws Exception {
|
public void testNestedConstructorFromClass() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -2192,6 +2192,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47741.kt")
|
||||||
|
public void testKt47741() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/callableReference/function/kt47741.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConstructorFromClass.kt")
|
@TestMetadata("nestedConstructorFromClass.kt")
|
||||||
public void testNestedConstructorFromClass() throws Exception {
|
public void testNestedConstructorFromClass() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||||
|
|||||||
Generated
+5
@@ -2192,6 +2192,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47741.kt")
|
||||||
|
public void testKt47741() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/callableReference/function/kt47741.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConstructorFromClass.kt")
|
@TestMetadata("nestedConstructorFromClass.kt")
|
||||||
public void testNestedConstructorFromClass() throws Exception {
|
public void testNestedConstructorFromClass() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||||
|
|||||||
Generated
+5
@@ -2192,6 +2192,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47741.kt")
|
||||||
|
public void testKt47741() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/callableReference/function/kt47741.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConstructorFromClass.kt")
|
@TestMetadata("nestedConstructorFromClass.kt")
|
||||||
public void testNestedConstructorFromClass() throws Exception {
|
public void testNestedConstructorFromClass() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -1622,6 +1622,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/kt32462.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47741.kt")
|
||||||
|
public void testKt47741() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/callableReference/function/kt47741.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConstructorFromClass.kt")
|
@TestMetadata("nestedConstructorFromClass.kt")
|
||||||
public void testNestedConstructorFromClass() throws Exception {
|
public void testNestedConstructorFromClass() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
runTest("compiler/testData/codegen/box/callableReference/function/nestedConstructorFromClass.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user