Fix === comparison for primitive types
#KT-6590 Fixed
This commit is contained in:
@@ -664,10 +664,10 @@ public abstract class StackValue {
|
||||
left.put(this.operandType, v);
|
||||
right.put(this.operandType, v);
|
||||
int opcode;
|
||||
if (opToken == JetTokens.EQEQ) {
|
||||
if (opToken == JetTokens.EQEQ || opToken == JetTokens.EQEQEQ) {
|
||||
opcode = jumpIfFalse ? IFNE : IFEQ;
|
||||
}
|
||||
else if (opToken == JetTokens.EXCLEQ) {
|
||||
else if (opToken == JetTokens.EXCLEQ || opToken == JetTokens.EXCLEQEQEQ) {
|
||||
opcode = jumpIfFalse ? IFEQ : IFNE;
|
||||
}
|
||||
else if (opToken == JetTokens.GT) {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
fun box(): String {
|
||||
val i: Int = 10000
|
||||
if (!(i === i)) return "Fail int ==="
|
||||
if (i !== i) return "Fail int !=="
|
||||
|
||||
val j: Long = 123L
|
||||
if (!(j === j)) return "Fail long ==="
|
||||
if (j !== j) return "Fail long !=="
|
||||
|
||||
val d: Double = 3.14
|
||||
if (!(d === d)) return "Fail double ==="
|
||||
if (d !== d) return "Fail double !=="
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -5550,6 +5550,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6590_identityEquals.kt")
|
||||
public void testKt6590_identityEquals() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt6590_identityEquals.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt665.kt")
|
||||
public void testKt665() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt665.kt");
|
||||
|
||||
Reference in New Issue
Block a user