diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java index da46b1b5e70..f94bad7e647 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java @@ -148,12 +148,8 @@ public class AsmUtil { return type == Type.INT_TYPE || type == Type.SHORT_TYPE || type == Type.BYTE_TYPE || type == Type.CHAR_TYPE; } - public static boolean isNonFloatingPointPrimitive(Type type) { - return isIntPrimitive(type) || type == Type.LONG_TYPE || type == Type.BOOLEAN_TYPE; - } - - public static boolean isIntPrimitiveOrBoolean(Type type) { - return isIntPrimitive(type) || type == Type.BOOLEAN_TYPE; + public static boolean isIntOrLongPrimitive(Type type) { + return isIntPrimitive(type) || type == Type.LONG_TYPE; } public static boolean isNumberPrimitiveOrBoolean(Type type) { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/BoxedVsPrimitiveBranchedValues.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/BoxedVsPrimitiveBranchedValues.kt index b55b695845c..02e88a1b179 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/BoxedVsPrimitiveBranchedValues.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/BoxedVsPrimitiveBranchedValues.kt @@ -249,7 +249,7 @@ class BoxedToPrimitiveEquality private constructor( @JvmStatic fun isApplicable(opToken: IElementType, leftType: Type, rightType: Type) = (opToken == KtTokens.EQEQ || opToken == KtTokens.EXCLEQ) && - AsmUtil.isNonFloatingPointPrimitive(rightType) && + AsmUtil.isIntOrLongPrimitive(rightType) && AsmUtil.isBoxedTypeOf(leftType, rightType) } } @@ -323,7 +323,7 @@ class PrimitiveToBoxedEquality private constructor( @JvmStatic fun isApplicable(opToken: IElementType, leftType: Type, rightType: Type) = (opToken == KtTokens.EQEQ || opToken == KtTokens.EXCLEQ) && - AsmUtil.isNonFloatingPointPrimitive(leftType) && + AsmUtil.isIntOrLongPrimitive(leftType) && AsmUtil.isBoxedTypeOf(rightType, leftType) } } @@ -402,7 +402,7 @@ class PrimitiveToObjectEquality private constructor( @JvmStatic fun isApplicable(opToken: IElementType, leftType: Type, rightType: Type) = (opToken == KtTokens.EQEQ || opToken == KtTokens.EXCLEQ) && - AsmUtil.isNonFloatingPointPrimitive(leftType) && + AsmUtil.isIntOrLongPrimitive(leftType) && rightType.sort == Type.OBJECT } } \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/conditions/noBoxingForBoxedEqPrimitive.kt b/compiler/testData/codegen/bytecodeText/conditions/noBoxingForBoxedEqPrimitive.kt index 1ab23a094e2..d20f0230e33 100644 --- a/compiler/testData/codegen/bytecodeText/conditions/noBoxingForBoxedEqPrimitive.kt +++ b/compiler/testData/codegen/bytecodeText/conditions/noBoxingForBoxedEqPrimitive.kt @@ -16,11 +16,11 @@ fun testInt2(a: Int?, b: Int) = a != b fun testLong1(a: Long?, b: Long) = a == b fun testLong2(a: Long?, b: Long) = a != b -// 2 booleanValue // 2 charValue // 2 byteValue // 2 shortValue // 2 intValue // 2 longValue -// 0 valueOf -// 0 areEqual \ No newline at end of file +// 2 valueOf +// 2 Boolean.valueOf +// 2 areEqual \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqBoxed.kt b/compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqBoxed.kt index ba874eddf49..7fb29c4428c 100644 --- a/compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqBoxed.kt +++ b/compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqBoxed.kt @@ -16,11 +16,11 @@ fun testInt2(a: Int, b: Int?) = a != b fun testLong1(a: Long, b: Long?) = a == b fun testLong2(a: Long, b: Long?) = a != b -// 2 booleanValue // 2 charValue // 2 byteValue // 2 shortValue // 2 intValue // 2 longValue -// 0 valueOf -// 0 areEqual \ No newline at end of file +// 2 valueOf +// 2 Boolean.valueOf +// 2 areEqual \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqObject.kt b/compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqObject.kt index 09aec19e542..b6ea04c6c67 100644 --- a/compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqObject.kt +++ b/compiler/testData/codegen/bytecodeText/conditions/noBoxingForPrimitiveEqObject.kt @@ -16,11 +16,11 @@ fun testInt2(a: Int, b: Any?) = a != b fun testLong1(a: Long, b: Any?) = a == b fun testLong2(a: Long, b: Any?) = a != b -// 2 booleanValue // 2 charValue // 2 byteValue // 2 shortValue // 2 intValue // 2 longValue -// 0 valueOf -// 0 areEqual \ No newline at end of file +// 2 valueOf +// 2 Boolean.valueOf +// 2 areEqual \ No newline at end of file