// !LANGUAGE: +ContextReceivers // TARGET_BACKEND: JVM_IR data class Pair(val first: A, val second: B) context(Comparator) infix operator fun T.compareTo(other: T) = compare(this, other) context(Comparator) val Pair.min get() = if (first < second) first else second fun box(): String { val comparator = Comparator { a, b -> if (a == null || b == null) 0 else a.length.compareTo(b.length) } return with(comparator) { Pair("OK", "fail").min } }