Files
kotlin-fork/compiler/testData/ir/irText/expressions/kt23030.kt.txt
T
Dmitriy Novozhilov b454fcc1e0 [FIR] Save IR dumps to .ir.txt files instead of .txt in tests
This is needed to avoid clashes between different dumps from different
  handlers
2021-10-12 17:26:36 +03:00

55 lines
1.1 KiB
Plaintext
Vendored

operator fun Int.compareTo(c: Char): Int {
return 0
}
fun testOverloadedCompareToCall(x: Int, y: Char): Boolean {
return less(arg0 = x.compareTo(c = y), arg1 = 0)
}
fun testOverloadedCompareToCallWithSmartCast(x: Any, y: Any): Boolean {
return when {
when {
x is Int -> y is Char
else -> false
} -> less(arg0 = x /*as Int */.compareTo(c = y /*as Char */), arg1 = 0)
else -> false
}
}
fun testEqualsWithSmartCast(x: Any, y: Any): Boolean {
return when {
when {
x is Int -> y is Char
else -> false
} -> EQEQ(arg0 = x, arg1 = y)
else -> false
}
}
class C {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
operator fun Int.compareTo(c: Char): Int {
return 0
}
fun testMemberExtensionCompareToCall(x: Int, y: Char): Boolean {
return less(arg0 = (<this>, x).compareTo(c = y), arg1 = 0)
}
fun testMemberExtensionCompareToCallWithSmartCast(x: Any, y: Any): Boolean {
return when {
when {
x is Int -> y is Char
else -> false
} -> less(arg0 = (<this>, x /*as Int */).compareTo(c = y /*as Char */), arg1 = 0)
else -> false
}
}
}