Do not box primitives for 'primitive == object'

NB user-defined 'equals' can violate contract for 'Object#equals', e.g.,
it can be asymmetric.
Thus we can't avoid boxing for 'object == primitive'.
This commit is contained in:
Dmitry Petrov
2017-07-14 15:18:19 +03:00
parent fa42f202fa
commit 8e9c0294fe
33 changed files with 828 additions and 116 deletions
@@ -294,12 +294,6 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
doTest(fileName);
}
@TestMetadata("noBoxingForBoxedEqPrimitive.kt")
public void testNoBoxingForBoxedEqPrimitive() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/noBoxingForBoxedEqPrimitive.kt");
doTest(fileName);
}
@TestMetadata("noFlagAnnotations.kt")
public void testNoFlagAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/noFlagAnnotations.kt");
@@ -875,6 +869,24 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
doTest(fileName);
}
@TestMetadata("noBoxingForBoxedEqPrimitive.kt")
public void testNoBoxingForBoxedEqPrimitive() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/conditions/noBoxingForBoxedEqPrimitive.kt");
doTest(fileName);
}
@TestMetadata("noBoxingForPrimitiveEqBoxed.kt")
public void testNoBoxingForPrimitiveEqBoxed() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqBoxed.kt");
doTest(fileName);
}
@TestMetadata("noBoxingForPrimitiveEqObject.kt")
public void testNoBoxingForPrimitiveEqObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqObject.kt");
doTest(fileName);
}
@TestMetadata("nullCompare.kt")
public void testNullCompare() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/conditions/nullCompare.kt");