d163853c97
This commit handles "subclass: super-interface by delegate-expression". During Psi2Fir, for each delegate, we add to the subclass a synthetic field (which has type super-interface), and an assignment of the delegate-expression to the synthetic field in the primary constructor, so that the delegate-expression can be resolved and transformed along the way. During Fir2Ir, we look up delegatable members from the super-interface and generate corresponding functions/properties for the subclass. TODO: support for generic delegatable members and generic super-interface.
17 lines
332 B
Kotlin
Vendored
17 lines
332 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
|
|
interface IFoo {
|
|
fun getO(): String
|
|
val k: String
|
|
|
|
val ok: String get() = getO() + k
|
|
}
|
|
|
|
inline class InlineFooImpl(val s: String): IFoo {
|
|
override fun getO(): String = s
|
|
override val k: String get() = "K"
|
|
}
|
|
|
|
class Test(s: String) : IFoo by InlineFooImpl(s)
|
|
|
|
fun box() = Test("O").ok |