FIR: Support FirComparisonOperator in Fir2Ir
^KT-31163 Fixed
This commit is contained in:
+1
-2
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
operator fun Int.compareTo(c: Char) = 0
|
||||
|
||||
fun foo(x: Int, y: Char): String {
|
||||
@@ -10,4 +9,4 @@ fun foo(x: Int, y: Char): String {
|
||||
|
||||
fun box(): String {
|
||||
return foo(42, 'O')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
operator fun Int.compareTo(c: Char) = 0
|
||||
|
||||
fun foo(x: Int, y: Char): String {
|
||||
@@ -11,4 +10,4 @@ fun foo(x: Int, y: Char): String {
|
||||
|
||||
fun box(): String {
|
||||
return foo(42, 'O')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
inline fun ltx(a: Comparable<Any>, b: Any) = a < b
|
||||
inline fun lex(a: Comparable<Any>, b: Any) = a <= b
|
||||
inline fun gex(a: Comparable<Any>, b: Any) = a >= b
|
||||
@@ -44,4 +43,4 @@ fun box(): String {
|
||||
|
||||
else -> "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
inline fun ltx(a: Comparable<Any>, b: Any) = a < b
|
||||
inline fun lex(a: Comparable<Any>, b: Any) = a <= b
|
||||
inline fun gex(a: Comparable<Any>, b: Any) = a >= b
|
||||
@@ -79,4 +77,4 @@ fun box(): String {
|
||||
|
||||
else -> "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class KeySpan(val left: String) {
|
||||
|
||||
public fun matches(value : String) : Boolean {
|
||||
@@ -11,4 +10,4 @@ class KeySpan(val left: String) {
|
||||
fun box() : String {
|
||||
KeySpan("1").matches("3")
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class C
|
||||
|
||||
operator fun C.compareTo(o: C) : Int {
|
||||
@@ -9,4 +8,4 @@ operator fun C.compareTo(o: C) : Int {
|
||||
return -1
|
||||
}
|
||||
|
||||
fun box() : String = if (C() > C()) "OK" else "FAIL"
|
||||
fun box() : String = if (C() > C()) "OK" else "FAIL"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: -ProperIeee754Comparisons
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
||||
fun box(): String {
|
||||
@@ -14,4 +13,4 @@ fun box(): String {
|
||||
}
|
||||
|
||||
return "fail"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun checkLess(x: Boolean, y: Boolean) = when {
|
||||
x >= y -> "Fail $x >= $y"
|
||||
!(x < y) -> "Fail !($x < $y)"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun checkLess(x: Double, y: Int) = when {
|
||||
x >= y -> "Fail $x >= $y"
|
||||
!(x < y) -> "Fail !($x < $y)"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun checkLess(x: Double, y: Long) = when {
|
||||
x >= y -> "Fail $x >= $y"
|
||||
!(x < y) -> "Fail !($x < $y)"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun checkLess(x: Array<Int>, y: Array<Int>) = when {
|
||||
x >= y -> "Fail $x >= $y"
|
||||
!(x < y) -> "Fail !($x < $y)"
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
class A(val x: Int)
|
||||
|
||||
operator fun A.compareTo(other: A) = x.compareTo(other.x)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun checkLess(x: Int, y: Double) = when {
|
||||
x >= y -> "Fail $x >= $y"
|
||||
!(x < y) -> "Fail !($x < $y)"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun checkLess(x: Int, y: Long) = when {
|
||||
x >= y -> "Fail $x >= $y"
|
||||
!(x < y) -> "Fail !($x < $y)"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun checkLess(x: Long, y: Double) = when {
|
||||
x >= y -> "Fail $x >= $y"
|
||||
!(x < y) -> "Fail !($x < $y)"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun checkLess(x: Long, y: Int) = when {
|
||||
x >= y -> "Fail $x >= $y"
|
||||
!(x < y) -> "Fail !($x < $y)"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun box(): String {
|
||||
if (1 >= 1.9) return "Fail #1"
|
||||
if (1.compareTo(1.1) >= 0) return "Fail #2"
|
||||
|
||||
Reference in New Issue
Block a user