Files
kotlin-fork/compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.kt
T
2021-12-02 20:23:54 +03:00

28 lines
395 B
Kotlin
Vendored

interface A {
fun f() {}
}
class B : A
fun testLocalFunction() {
context(A)
fun local() {
f()
}
with(B()) {
local()
}
<!NO_CONTEXT_RECEIVER!>local()<!>
}
fun testLocalClass() {
context(A)
class Local {
fun local() {
f()
}
}
with(B()) {
Local().local()
}
<!NO_CONTEXT_RECEIVER!>Local()<!>
}