FIR: Fix interface delegation ABI

- Unifies the name of the `$$delegate_<n>` field between K1 and K2.
- Make the `$$delegate_<n>` field private
This commit is contained in:
Steven Schäfer
2022-11-16 18:27:56 +01:00
committed by Space Team
parent 91749737f8
commit a7ba081d22
44 changed files with 232 additions and 233 deletions
@@ -70,7 +70,7 @@ FILE fqName:<root> fileName:/annotationsOnDelegatedMembers.kt
$this: VALUE_PARAMETER name:<this> type:<root>.DFoo
BLOCK_BODY
CALL 'public abstract fun testFun (): kotlin.Unit declared in <root>.IFoo' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.IFoo visibility:local [final]' type=<root>.IFoo origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IFoo visibility:private [final]' type=<root>.IFoo origin=null
receiver: GET_VAR '<this>: <root>.DFoo declared in <root>.DFoo.testFun' type=<root>.DFoo origin=null
FUN DELEGATED_MEMBER name:testExtFun visibility:public modality:OPEN <> ($this:<root>.DFoo, $receiver:kotlin.String) returnType:kotlin.Unit
annotations:
@@ -81,7 +81,7 @@ FILE fqName:<root> fileName:/annotationsOnDelegatedMembers.kt
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String
BLOCK_BODY
CALL 'public abstract fun testExtFun (): kotlin.Unit declared in <root>.IFoo' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.IFoo visibility:local [final]' type=<root>.IFoo origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IFoo visibility:private [final]' type=<root>.IFoo origin=null
receiver: GET_VAR '<this>: <root>.DFoo declared in <root>.DFoo.testExtFun' type=<root>.DFoo origin=null
$receiver: GET_VAR '<this>: kotlin.String declared in <root>.DFoo.testExtFun' type=kotlin.String origin=null
PROPERTY DELEGATED_MEMBER name:testVal visibility:public modality:OPEN [val]
@@ -97,7 +97,7 @@ FILE fqName:<root> fileName:/annotationsOnDelegatedMembers.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-testVal> (): kotlin.String declared in <root>.DFoo'
CALL 'public abstract fun <get-testVal> (): kotlin.String declared in <root>.IFoo' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.IFoo visibility:local [final]' type=<root>.IFoo origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IFoo visibility:private [final]' type=<root>.IFoo origin=null
receiver: GET_VAR '<this>: <root>.DFoo declared in <root>.DFoo.<get-testVal>' type=<root>.DFoo origin=null
PROPERTY DELEGATED_MEMBER name:testExtVal visibility:public modality:OPEN [val]
annotations:
@@ -113,10 +113,10 @@ FILE fqName:<root> fileName:/annotationsOnDelegatedMembers.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-testExtVal> (): kotlin.String declared in <root>.DFoo'
CALL 'public abstract fun <get-testExtVal> (): kotlin.String declared in <root>.IFoo' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.IFoo visibility:local [final]' type=<root>.IFoo origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IFoo visibility:private [final]' type=<root>.IFoo origin=null
receiver: GET_VAR '<this>: <root>.DFoo declared in <root>.DFoo.<get-testExtVal>' type=<root>.DFoo origin=null
$receiver: GET_VAR '<this>: kotlin.String declared in <root>.DFoo.<get-testExtVal>' type=kotlin.String origin=null
FIELD DELEGATE name:<$$delegate_0> type:<root>.IFoo visibility:local [final]
FIELD DELEGATE name:$$delegate_0 type:<root>.IFoo visibility:private [final]
EXPRESSION_BODY
GET_VAR 'd: <root>.IFoo declared in <root>.DFoo.<init>' type=<root>.IFoo origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
@@ -32,26 +32,26 @@ class DFoo : IFoo {
@Ann
override fun testFun() {
<this>.#<$$delegate_0>.testFun()
<this>.#$$delegate_0.testFun()
}
@Ann
override fun String.testExtFun() {
(<this>.#<$$delegate_0>, <this>).testExtFun()
(<this>.#$$delegate_0, <this>).testExtFun()
}
@Ann
override val testVal: String
override get(): String {
return <this>.#<$$delegate_0>.<get-testVal>()
return <this>.#$$delegate_0.<get-testVal>()
}
@Ann
override val String.testExtVal: String
override get(): String {
return (<this>.#<$$delegate_0>, <this>).<get-testExtVal>()
return (<this>.#$$delegate_0, <this>).<get-testExtVal>()
}
local /* final field */ val <$$delegate_0>: IFoo = d
private /* final field */ val $$delegate_0: IFoo = d
}
@@ -53,7 +53,7 @@ FILE fqName:<root> fileName:/inheritingDeprecation.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-prop> (): kotlin.String declared in <root>.Delegated'
CALL 'public open fun <get-prop> (): kotlin.String declared in <root>.IFoo' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.IFoo visibility:local [final]' type=<root>.IFoo origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IFoo visibility:private [final]' type=<root>.IFoo origin=null
receiver: GET_VAR '<this>: <root>.Delegated declared in <root>.Delegated.<get-prop>' type=<root>.Delegated origin=null
PROPERTY DELEGATED_MEMBER name:extProp visibility:public modality:OPEN [val]
annotations:
@@ -69,10 +69,10 @@ FILE fqName:<root> fileName:/inheritingDeprecation.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-extProp> (): kotlin.String declared in <root>.Delegated'
CALL 'public open fun <get-extProp> (): kotlin.String declared in <root>.IFoo' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.IFoo visibility:local [final]' type=<root>.IFoo origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IFoo visibility:private [final]' type=<root>.IFoo origin=null
receiver: GET_VAR '<this>: <root>.Delegated declared in <root>.Delegated.<get-extProp>' type=<root>.Delegated origin=null
$receiver: GET_VAR '<this>: kotlin.String declared in <root>.Delegated.<get-extProp>' type=kotlin.String origin=null
FIELD DELEGATE name:<$$delegate_0> type:<root>.IFoo visibility:local [final]
FIELD DELEGATE name:$$delegate_0 type:<root>.IFoo visibility:private [final]
EXPRESSION_BODY
GET_VAR 'foo: <root>.IFoo declared in <root>.Delegated.<init>' type=<root>.IFoo origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
@@ -23,16 +23,16 @@ class Delegated : IFoo {
@Deprecated(message = "")
override val prop: String
override get(): String {
return <this>.#<$$delegate_0>.<get-prop>()
return <this>.#$$delegate_0.<get-prop>()
}
@Deprecated(message = "")
override val String.extProp: String
override get(): String {
return (<this>.#<$$delegate_0>, <this>).<get-extProp>()
return (<this>.#$$delegate_0, <this>).<get-extProp>()
}
local /* final field */ val <$$delegate_0>: IFoo = foo
private /* final field */ val $$delegate_0: IFoo = foo
}
@@ -44,10 +44,10 @@ FILE fqName:<root> fileName:/kt35550.kt
RETURN type=kotlin.Nothing from='public open fun <get-id> <T> (): T of <root>.A.<get-id> declared in <root>.A'
CALL 'public open fun <get-id> <T> (): T of <root>.I.<get-id> declared in <root>.I' type=T of <root>.A.<get-id> origin=null
<T>: T of <root>.A.<get-id>
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.I visibility:local [final]' type=<root>.I origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.I visibility:private [final]' type=<root>.I origin=null
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-id>' type=<root>.A origin=null
$receiver: GET_VAR '<this>: T of <root>.A.<get-id> declared in <root>.A.<get-id>' type=T of <root>.A.<get-id> origin=null
FIELD DELEGATE name:<$$delegate_0> type:<root>.I visibility:local [final]
FIELD DELEGATE name:$$delegate_0 type:<root>.I visibility:private [final]
EXPRESSION_BODY
GET_VAR 'i: <root>.I declared in <root>.A.<init>' type=<root>.I origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
@@ -15,9 +15,9 @@ class A : I {
override val <T : Any?> T.id: T
override get(): T {
return (<this>.#<$$delegate_0>, <this>).<get-id><T>()
return (<this>.#$$delegate_0, <this>).<get-id><T>()
}
local /* final field */ val <$$delegate_0>: I = i
private /* final field */ val $$delegate_0: I = i
}
@@ -42,7 +42,7 @@ FILE fqName:<root> fileName:/delegatedMembers.kt
VALUE_PARAMETER name:x index:0 type:kotlin.Int
BLOCK_BODY
CALL 'public abstract fun foo (x: kotlin.Int): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.IBase<TT of <root>.Test> visibility:local [final]' type=<root>.IBase<TT of <root>.Test> origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]' type=<root>.IBase<TT of <root>.Test> origin=null
receiver: GET_VAR '<this>: <root>.Test<TT of <root>.Test> declared in <root>.Test.foo' type=<root>.Test<TT of <root>.Test> origin=null
x: GET_VAR 'x: kotlin.Int declared in <root>.Test.foo' type=kotlin.Int origin=null
FUN DELEGATED_MEMBER name:qux visibility:public modality:OPEN <X> ($this:<root>.Test<TT of <root>.Test>, t:TT of <root>.Test, x:X of <root>.Test.qux) returnType:kotlin.Unit
@@ -55,7 +55,7 @@ FILE fqName:<root> fileName:/delegatedMembers.kt
BLOCK_BODY
CALL 'public abstract fun qux <X> (t: T of <root>.IBase, x: X of <root>.IBase.qux): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
<X>: X of <root>.Test.qux
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.IBase<TT of <root>.Test> visibility:local [final]' type=<root>.IBase<TT of <root>.Test> origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]' type=<root>.IBase<TT of <root>.Test> origin=null
receiver: GET_VAR '<this>: <root>.Test<TT of <root>.Test> declared in <root>.Test.qux' type=<root>.Test<TT of <root>.Test> origin=null
t: GET_VAR 't: TT of <root>.Test declared in <root>.Test.qux' type=TT of <root>.Test origin=null
x: GET_VAR 'x: X of <root>.Test.qux declared in <root>.Test.qux' type=X of <root>.Test.qux origin=null
@@ -70,9 +70,9 @@ FILE fqName:<root> fileName:/delegatedMembers.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-bar> (): kotlin.Int declared in <root>.Test'
CALL 'public abstract fun <get-bar> (): kotlin.Int declared in <root>.IBase' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.IBase<TT of <root>.Test> visibility:local [final]' type=<root>.IBase<TT of <root>.Test> origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]' type=<root>.IBase<TT of <root>.Test> origin=null
receiver: GET_VAR '<this>: <root>.Test<TT of <root>.Test> declared in <root>.Test.<get-bar>' type=<root>.Test<TT of <root>.Test> origin=null
FIELD DELEGATE name:<$$delegate_0> type:<root>.IBase<TT of <root>.Test> visibility:local [final]
FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]
EXPRESSION_BODY
GET_VAR 'impl: <root>.IBase<TT of <root>.Test> declared in <root>.Test.<init>' type=<root>.IBase<TT of <root>.Test> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
@@ -15,18 +15,18 @@ class Test<TT : Any?> : IBase<TT> {
}
override fun foo(x: Int) {
<this>.#<$$delegate_0>.foo(x = x)
<this>.#$$delegate_0.foo(x = x)
}
override fun <X : Any?> qux(t: TT, x: X) {
<this>.#<$$delegate_0>.qux<X>(t = t, x = x)
<this>.#$$delegate_0.qux<X>(t = t, x = x)
}
override val bar: Int
override get(): Int {
return <this>.#<$$delegate_0>.<get-bar>()
return <this>.#$$delegate_0.<get-bar>()
}
local /* final field */ val <$$delegate_0>: IBase<TT> = impl
private /* final field */ val $$delegate_0: IBase<TT> = impl
}