// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers 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.max get() = if (first > second) first else second fun test() { val comparator = Comparator { a, b -> if (a == null || b == null) 0 else a.length.compareTo(b.length) } with(comparator) { Pair("OK", "fail").max } }