Fix wrong checkcast for === on objects
#KT-6747 Fixed
This commit is contained in:
@@ -527,10 +527,6 @@ public class AsmUtil {
|
||||
return StackValue.cmp(opToken, leftType, left, right);
|
||||
}
|
||||
|
||||
if (opToken == JetTokens.EQEQEQ || opToken == JetTokens.EXCLEQEQEQ) {
|
||||
return StackValue.cmp(opToken, leftType, left, right);
|
||||
}
|
||||
|
||||
return StackValue.operation(Type.BOOLEAN_TYPE, new Function1<InstructionAdapter, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(InstructionAdapter v) {
|
||||
|
||||
@@ -3056,7 +3056,16 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
rightType = boxType(rightType);
|
||||
}
|
||||
|
||||
return genEqualsForExpressionsOnStack(opToken, genLazy(left, leftType), genLazy(right, rightType));
|
||||
StackValue leftValue = genLazy(left, leftType);
|
||||
StackValue rightValue = genLazy(right, rightType);
|
||||
|
||||
if (opToken == JetTokens.EQEQEQ || opToken == JetTokens.EXCLEQEQEQ) {
|
||||
// TODO: always casting to the type of the left operand in case of primitives looks wrong
|
||||
Type operandType = isPrimitive(leftType) ? leftType : OBJECT_TYPE;
|
||||
return StackValue.cmp(opToken, operandType, leftValue, rightValue);
|
||||
}
|
||||
|
||||
return genEqualsForExpressionsOnStack(opToken, leftValue, rightValue);
|
||||
}
|
||||
|
||||
private boolean isIntZero(JetExpression expr, Type exprType) {
|
||||
|
||||
Reference in New Issue
Block a user