KT-19634: Fix <boxed_value> == <primitive_value> converted to reference equality
#KT-19634 fixed
This commit is contained in:
committed by
Simon Ogorodnik
parent
9dc5354f24
commit
0fd5c6f1ca
@@ -197,6 +197,8 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
|
||||
is PsiPrimitiveType, is PsiArrayType -> return true
|
||||
|
||||
is PsiClassType -> {
|
||||
if (right?.type is PsiPrimitiveType) return true
|
||||
|
||||
val psiClass = type.resolve() ?: return false
|
||||
if (!psiClass.hasModifierProperty(PsiModifier.FINAL)) return false
|
||||
if (psiClass.isEnum) return true
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
public class TestBoxedEqEqPrimitive {
|
||||
public boolean test(Double value) {
|
||||
return value == 3.14;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class TestBoxedEqEqPrimitive {
|
||||
fun test(value: Double?): Boolean {
|
||||
return value == 3.14
|
||||
}
|
||||
}
|
||||
@@ -2933,6 +2933,12 @@ public class JavaToKotlinConverterForWebDemoTestGenerated extends AbstractJavaTo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt-19634.java")
|
||||
public void testKt_19634() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/issues/kt-19634.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt-5294.java")
|
||||
public void testKt_5294() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/issues/kt-5294.java");
|
||||
|
||||
@@ -2933,6 +2933,12 @@ public class JavaToKotlinConverterSingleFileTestGenerated extends AbstractJavaTo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt-19634.java")
|
||||
public void testKt_19634() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/issues/kt-19634.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt-5294.java")
|
||||
public void testKt_5294() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("j2k/testData/fileOrElement/issues/kt-5294.java");
|
||||
|
||||
Reference in New Issue
Block a user