JVM IR: fix operand type for CompareTo intrinsic
It's incorrect to take the first parameter type from the expression itself because it can be nullable if smart casts are used. And if it's nullable, it's mapped to the wrapper type and calling `comparisonOperandType` for it makes no sense. Instead, take the type from the callee function, as it's guaranteed to be mapped to a JVM primitive type. E.g. in `test1` function in the added test, the problem was that the dispatch receiver type of the call expression is `Double?`, which is mapped to `java/lang/Double`, whereas we clearly wanted to obtain the primitive `D` (double) type. #KT-52163 Fixed
This commit is contained in:
+10
@@ -21170,6 +21170,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/intrinsics/kt12125_inc_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt52163_boolean.kt")
|
||||
public void testKt52163_boolean() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/intrinsics/kt52163_boolean.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt52163_doubleCompareToInt.kt")
|
||||
public void testKt52163_doubleCompareToInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/intrinsics/kt52163_doubleCompareToInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt5937.kt")
|
||||
public void testKt5937() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/intrinsics/kt5937.kt");
|
||||
|
||||
Reference in New Issue
Block a user