mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 15:53:46 +00:00
The reference can be lowered to `this` if it is captured in the lexical scope of the corresponding enum entry, and not used by the enum entry's super constructor. Otherwise, it is lowered to `GETFIELD SomeEnum.SomeEntry`.
23 lines
413 B
Kotlin
Vendored
23 lines
413 B
Kotlin
Vendored
interface IFoo {
|
|
fun foo(): String
|
|
}
|
|
|
|
interface IBar {
|
|
fun bar(): String
|
|
}
|
|
|
|
enum class Test : IFoo, IBar {
|
|
FOO {
|
|
// FOO referenced from inner class constructor with initialized 'this',
|
|
// in delegate initializer
|
|
inner class Inner : IFoo by FOO
|
|
|
|
val z = Inner()
|
|
|
|
override fun foo() = "OK"
|
|
|
|
override fun bar() = z.foo()
|
|
}
|
|
}
|
|
|
|
fun box() = Test.FOO.bar() |