[FE] Support local contextual declarations
This commit is contained in:
committed by
TeamCityServer
parent
43d11c7c4b
commit
875f4ea31c
+28
@@ -0,0 +1,28 @@
|
||||
interface A {
|
||||
fun f() {}
|
||||
}
|
||||
class B : A
|
||||
|
||||
fun testLocalFunction() {
|
||||
context(A)
|
||||
fun local() {
|
||||
f()
|
||||
}
|
||||
with(B()) {
|
||||
local()
|
||||
}
|
||||
local()
|
||||
}
|
||||
|
||||
fun testLocalClass() {
|
||||
context(A)
|
||||
class Local {
|
||||
fun local() {
|
||||
f()
|
||||
}
|
||||
}
|
||||
with(B()) {
|
||||
Local().local()
|
||||
}
|
||||
Local()
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
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()<!>
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public fun testLocalClass(): kotlin.Unit
|
||||
public fun testLocalFunction(): kotlin.Unit
|
||||
|
||||
public interface A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun f(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B : A {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun f(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user