JVM, JVM_IR: KT-42281 proper array->primitive coercion
This commit is contained in:
@@ -672,8 +672,8 @@ public abstract class StackValue {
|
||||
box(fromType, toType, v);
|
||||
}
|
||||
}
|
||||
else if (fromType.getSort() == Type.OBJECT) {
|
||||
//toType is primitive here
|
||||
else if (fromType.getSort() == Type.OBJECT || fromType.getSort() == Type.ARRAY) {
|
||||
// here toType is primitive and fromType is reference (object or array)
|
||||
Type unboxedType = unboxPrimitiveTypeOrNull(fromType);
|
||||
if (unboxedType != null) {
|
||||
unbox(fromType, unboxedType, v);
|
||||
|
||||
Generated
+5
@@ -20795,6 +20795,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/intEqualsNullableIntWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt42281.kt")
|
||||
public void testKt42281() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/kt42281.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectWithAsymmetricEqualsEqPrimitive.kt")
|
||||
public void testObjectWithAsymmetricEqualsEqPrimitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt");
|
||||
|
||||
+5
-2
@@ -420,8 +420,11 @@ class ExpressionCodegen(
|
||||
visitStatementContainer(expression, data)
|
||||
|
||||
override fun visitCall(expression: IrCall, data: BlockInfo): PromisedValue {
|
||||
classCodegen.context.irIntrinsics.getIntrinsic(expression.symbol)
|
||||
?.invoke(expression, this, data)?.let { return it }
|
||||
val intrinsic = classCodegen.context.irIntrinsics.getIntrinsic(expression.symbol)
|
||||
if (intrinsic != null) {
|
||||
intrinsic.invoke(expression, this, data)
|
||||
?.let { return it }
|
||||
}
|
||||
|
||||
val callee = expression.symbol.owner
|
||||
require(callee.parent is IrClass) { "Unhandled intrinsic in ExpressionCodegen: ${callee.render()}" }
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
return if (run { 123 != intArrayOf() as Any }) "OK" else "Fail"
|
||||
}
|
||||
+5
@@ -22566,6 +22566,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/intEqualsNullableIntWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt42281.kt")
|
||||
public void testKt42281() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/kt42281.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectWithAsymmetricEqualsEqPrimitive.kt")
|
||||
public void testObjectWithAsymmetricEqualsEqPrimitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt");
|
||||
|
||||
+5
@@ -22566,6 +22566,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/intEqualsNullableIntWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt42281.kt")
|
||||
public void testKt42281() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/kt42281.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectWithAsymmetricEqualsEqPrimitive.kt")
|
||||
public void testObjectWithAsymmetricEqualsEqPrimitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt");
|
||||
|
||||
+5
@@ -20795,6 +20795,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/intEqualsNullableIntWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt42281.kt")
|
||||
public void testKt42281() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/kt42281.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectWithAsymmetricEqualsEqPrimitive.kt")
|
||||
public void testObjectWithAsymmetricEqualsEqPrimitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt");
|
||||
|
||||
Generated
+5
@@ -17101,6 +17101,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/intEqualsNullableIntWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt42281.kt")
|
||||
public void testKt42281() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/kt42281.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectWithAsymmetricEqualsEqPrimitive.kt")
|
||||
public void testObjectWithAsymmetricEqualsEqPrimitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt");
|
||||
|
||||
Generated
+5
@@ -17101,6 +17101,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/intEqualsNullableIntWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt42281.kt")
|
||||
public void testKt42281() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/kt42281.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectWithAsymmetricEqualsEqPrimitive.kt")
|
||||
public void testObjectWithAsymmetricEqualsEqPrimitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt");
|
||||
|
||||
+5
@@ -17206,6 +17206,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/intEqualsNullableIntWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt42281.kt")
|
||||
public void testKt42281() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/kt42281.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectWithAsymmetricEqualsEqPrimitive.kt")
|
||||
public void testObjectWithAsymmetricEqualsEqPrimitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt");
|
||||
|
||||
Generated
+5
@@ -10647,6 +10647,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/intEqualsNullableIntWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt42281.kt")
|
||||
public void testKt42281() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/kt42281.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("objectWithAsymmetricEqualsEqPrimitive.kt")
|
||||
public void testObjectWithAsymmetricEqualsEqPrimitive() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/primitiveTypes/equalityWithObject/objectWithAsymmetricEqualsEqPrimitive.kt");
|
||||
|
||||
Reference in New Issue
Block a user