K2: add a black box test to confirm KT-53718 now works properly (JVM IR only)
Related to: KT-57584, KT-58110
This commit is contained in:
committed by
Space Team
parent
4b1368409d
commit
4d49bdb8ca
@@ -0,0 +1,34 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// Does not pass on other backends for various reasons, e.g.
|
||||
// - FIR/WASM: IR declaration with signature "/x|{}x[0]" found in SymbolTable and not found in declaration storage
|
||||
// - IR/JS: IrPropertyPublicSymbolImpl for /x|{}x[0] is already bound: PROPERTY name:x visibility:public modality:FINAL [val]
|
||||
// - Old BE: Couldn't inline method call: with(A()) { ... }
|
||||
// - See also: KT-57584, KT-58110
|
||||
// LANGUAGE: +ContextReceivers
|
||||
// ISSUE: KT-53718
|
||||
|
||||
class A
|
||||
|
||||
context(A)
|
||||
val x: Int
|
||||
get() = 1
|
||||
|
||||
val x: Int
|
||||
get() = 2
|
||||
|
||||
context(A)
|
||||
fun foo() = 3
|
||||
|
||||
fun foo() = 4
|
||||
|
||||
fun box(): String {
|
||||
if (x != 2) return "x = $x"
|
||||
if (foo() != 4) return "foo() = ${foo()}"
|
||||
|
||||
with(A()) {
|
||||
if (x != 1) return "context x = $x"
|
||||
if (foo() != 3) return "context foo() = ${foo()}"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user