blob: 6f32635e5f01158b4fa0193e56e1c76c6d93a374 [file]
// LANGUAGE: +ContextParameters
class A(val x: String) {
fun foo(): String {
return x
}
}
var result = ""
context(a: A)
fun test1(): String {
val a = A("O")
return a.foo()
}
context(a: A)
fun test2(): String {
val temp = a.foo()
val a = A("not OK")
return temp
}
fun box(): String {
with(A("not OK")) {
result += test1()
}
with(A("K")) {
result += test2()
}
return result
}