[Tests] Test samples from KEEP
This commit is contained in:
committed by
TeamCityServer
parent
b0a7be72e8
commit
d8faa9686d
+19
@@ -0,0 +1,19 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
data class Pair<A, B>(val first: A, val second: B)
|
||||
|
||||
context(Comparator<T>)
|
||||
infix operator fun <T> T.compareTo(other: T) = compare(this, other)
|
||||
|
||||
context(Comparator<T>)
|
||||
val <T> Pair<T, T>.min get() = if (first < second) first else second
|
||||
|
||||
fun box(): String {
|
||||
val comparator = Comparator<String> { a, b ->
|
||||
if (a == null || b == null) 0 else a.length.compareTo(b.length)
|
||||
}
|
||||
return with(comparator) {
|
||||
Pair("OK", "fail").min
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user