Fix for KT-11584: Regression in 1.0.1: incorrect comparison of Long! with integer constant
#KT-11584 Fixed
This commit is contained in:
@@ -3138,7 +3138,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
Type leftType = expressionType(left);
|
Type leftType = expressionType(left);
|
||||||
Type rightType = expressionType(right);
|
Type rightType = expressionType(right);
|
||||||
Callable callable = resolveToCallable((FunctionDescriptor) resolvedCall.getResultingDescriptor(), false, resolvedCall);
|
Callable callable = resolveToCallable((FunctionDescriptor) resolvedCall.getResultingDescriptor(), false, resolvedCall);
|
||||||
if (callable instanceof IntrinsicCallable) {
|
if (isPrimitive(leftType) && isPrimitive(rightType) && callable instanceof IntrinsicCallable) {
|
||||||
type = comparisonOperandType(leftType, rightType);
|
type = comparisonOperandType(leftType, rightType);
|
||||||
leftValue = gen(left);
|
leftValue = gen(left);
|
||||||
rightValue = gen(right);
|
rightValue = gen(right);
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
//FILE: JavaClass.java
|
||||||
|
|
||||||
|
class JavaClass {
|
||||||
|
public static Long get() { return 2364137526064485012L; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//FILE: test.kt
|
||||||
|
|
||||||
|
import JavaClass
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return if (JavaClass.get() > 0) "OK" else "fail"
|
||||||
|
}
|
||||||
@@ -730,6 +730,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compareWithBoxedLong.kt")
|
||||||
|
public void testCompareWithBoxedLong() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/binaryOp/compareWithBoxedLong.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("divisionByZero.kt")
|
@TestMetadata("divisionByZero.kt")
|
||||||
public void testDivisionByZero() throws Exception {
|
public void testDivisionByZero() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/binaryOp/divisionByZero.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/binaryOp/divisionByZero.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user