Files
kotlin-fork/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/compareTo.fir.kt.txt
T
2024-02-16 10:19:38 +00:00

92 lines
2.4 KiB
Kotlin
Vendored

data class Pair<A : Any?, B : Any?> {
val first: A
field = first
get
val second: B
field = second
get
constructor(first: A, second: B) /* primary */ {
super/*Any*/()
/* <init>() */
}
operator fun component1(): A {
return <this>.#first
}
operator fun component2(): B {
return <this>.#second
}
fun copy(first: A = <this>.#first, second: B = <this>.#second): Pair<A, B> {
return Pair<A, B>(first = first, second = second)
}
override operator fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
}
when {
other !is Pair<A, B> -> return false
}
val tmp_0: Pair<A, B> = other as Pair<A, B>
when {
EQEQ(arg0 = <this>.#first, arg1 = tmp_0.#first).not() -> return false
}
when {
EQEQ(arg0 = <this>.#second, arg1 = tmp_0.#second).not() -> return false
}
return true
}
override fun hashCode(): Int {
var result: Int = when {
EQEQ(arg0 = <this>.#first, arg1 = null) -> 0
else -> <this>.#first.hashCode()
}
result = result.times(other = 31).plus(other = when {
EQEQ(arg0 = <this>.#second, arg1 = null) -> 0
else -> <this>.#second.hashCode()
})
return result
}
override fun toString(): String {
return "Pair(" + "first=" + <this>.#first + ", " + "second=" + <this>.#second + ")"
}
}
fun box(): String {
val comparator: Comparator<String> = local fun <anonymous>(a: @FlexibleNullability String?, b: @FlexibleNullability String?): Int {
return when {
when {
EQEQ(arg0 = a, arg1 = null) -> true
else -> EQEQ(arg0 = b, arg1 = null)
} -> 0
else -> a.<get-length>().compareTo(other = b.<get-length>())
}
}
/*-> Comparator<String> */
return with<Comparator<String>, String>(receiver = comparator, block = local fun Comparator<String>.<anonymous>(): String {
return Pair<String, String>(first = "OK", second = "fail").<get-min><String>($context_receiver_0 = $this$with)
}
)
}
infix operator fun <T : Any?> T.compareTo($context_receiver_0: Comparator<T>, other: T): Int {
return $context_receiver_0.compare(p0 = <this>, p1 = other)
}
val <T : Any?> Pair<T, T>.min: T
get($context_receiver_0: Comparator<T>): T {
return when {
less(arg0 = <this>.<get-first>().compareTo<T>($context_receiver_0 = $context_receiver_0, other = <this>.<get-second>()), arg1 = 0) -> <this>.<get-first>()
else -> <this>.<get-second>()
}
}