[FIR2IR] Create delegated field for delegation to var property

^KT-65920 Fixed
This commit is contained in:
Dmitriy Novozhilov
2024-02-19 14:57:08 +02:00
committed by Space Team
parent 26fae9e83a
commit 3469e3b198
24 changed files with 152 additions and 9 deletions
@@ -26,6 +26,7 @@ class Test1<E : Any?> : IBase<E> {
}
class Test2 : IBase<String> {
private /* final field */ val $$delegate_0: IBase<String> = j
var j: IBase<String>
field = j
get
@@ -38,20 +39,20 @@ class Test2 : IBase<String> {
}
override fun <B : Any?> foo(a: String, b: B) {
<this>.#j.foo<B>(a = a, b = b)
<this>.#$$delegate_0.foo<B>(a = a, b = b)
}
override val <C : Any?> C.id: Map<String, C>?
override get(): Map<String, C>? {
return (<this>.#j, <this>).<get-id><C>()
return (<this>.#$$delegate_0, <this>).<get-id><C>()
}
override var <D : Any?> List<D>.x: D?
override get(): D? {
return (<this>.#j, <this>).<get-x><D>()
return (<this>.#$$delegate_0, <this>).<get-x><D>()
}
override set(<set-?>: D?) {
(<this>.#j, <this>).<set-x><D>(<set-?> = <set-?>)
(<this>.#$$delegate_0, <this>).<set-x><D>(<set-?> = <set-?>)
}
}