// !LANGUAGE: +ContextReceivers // TARGET_BACKEND: JVM_IR class Box(val x: E) class A { context(Box, Y) fun foo(): String = x.toString() + this@Y.toString() context(Box, Y) val p1: String get() = x.toString() + this@Y.toString() } context(Box, Y) fun bar(): String = x.toString() + this@Y.toString() fun box(): String { return with(Box("OK")) { with(56) { val a = A() if (a.foo() != "OK56") return "fail 1" if (a.p1 != "OK56") return "fail 2" val b = bar() if (b != "OK56") return "fail 3" return "OK" } } }