Generate widening cast for Byte and Short to Int
This commit is contained in:
-3
@@ -388,9 +388,6 @@ class OperatorExpressionGenerator(statementGenerator: StatementGenerator) : Stat
|
|||||||
operandType == targetType || operandNNType == targetType ->
|
operandType == targetType || operandNNType == targetType ->
|
||||||
this
|
this
|
||||||
|
|
||||||
targetType.isInt() && (operandNNType.isShort() || operandNNType.isByte()) ->
|
|
||||||
this
|
|
||||||
|
|
||||||
// TODO: don't rely on originalKotlinType.
|
// TODO: don't rely on originalKotlinType.
|
||||||
type.originalKotlinType!!.containsNull() ->
|
type.originalKotlinType!!.containsNull() ->
|
||||||
safeCallOnDispatchReceiver(this@OperatorExpressionGenerator, startOffset, endOffset) { dispatchReceiver ->
|
safeCallOnDispatchReceiver(this@OperatorExpressionGenerator, startOffset, endOffset) { dispatchReceiver ->
|
||||||
|
|||||||
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
|
||||||
fun testBoolean1(a: Boolean?, b: Boolean) = a == b
|
fun testBoolean1(a: Boolean?, b: Boolean) = a == b
|
||||||
fun testBoolean2(a: Boolean?, b: Boolean) = a != b
|
fun testBoolean2(a: Boolean?, b: Boolean) = a != b
|
||||||
|
|
||||||
|
|||||||
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
|
||||||
fun testBoolean1(a: Boolean, b: Boolean?) = a == b
|
fun testBoolean1(a: Boolean, b: Boolean?) = a == b
|
||||||
fun testBoolean2(a: Boolean, b: Boolean?) = a != b
|
fun testBoolean2(a: Boolean, b: Boolean?) = a != b
|
||||||
|
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// !LANGUAGE: +ProperIeee754Comparisons
|
// !LANGUAGE: +ProperIeee754Comparisons
|
||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
|
||||||
fun equals3(a: Byte?, b: Byte?) = a != null && b != null && a == b
|
fun equals3(a: Byte?, b: Byte?) = a != null && b != null && a == b
|
||||||
|
|
||||||
fun equals4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a == b else null!!
|
fun equals4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a == b else null!!
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// !LANGUAGE: -ProperIeee754Comparisons
|
// !LANGUAGE: -ProperIeee754Comparisons
|
||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
|
||||||
fun equals3(a: Byte?, b: Byte?) = a != null && b != null && a == b
|
fun equals3(a: Byte?, b: Byte?) = a != null && b != null && a == b
|
||||||
|
|
||||||
fun equals4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a == b else null!!
|
fun equals4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a == b else null!!
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// !LANGUAGE: +ProperIeee754Comparisons
|
// !LANGUAGE: +ProperIeee754Comparisons
|
||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
|
||||||
fun equals3(a: Short?, b: Short?) = a != null && b != null && a == b
|
fun equals3(a: Short?, b: Short?) = a != null && b != null && a == b
|
||||||
|
|
||||||
fun equals4(a: Short?, b: Short?) = if (a is Short && b is Short) a == b else null!!
|
fun equals4(a: Short?, b: Short?) = if (a is Short && b is Short) a == b else null!!
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// !LANGUAGE: -ProperIeee754Comparisons
|
// !LANGUAGE: -ProperIeee754Comparisons
|
||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
|
||||||
fun equals3(a: Short?, b: Short?) = a != null && b != null && a == b
|
fun equals3(a: Short?, b: Short?) = a != null && b != null && a == b
|
||||||
|
|
||||||
fun equals4(a: Short?, b: Short?) = if (a is Short && b is Short) a == b else null!!
|
fun equals4(a: Short?, b: Short?) = if (a is Short && b is Short) a == b else null!!
|
||||||
|
|||||||
Reference in New Issue
Block a user