Psi2ir: support generic properties in class delegation

Since property accessor descriptors (unlike corresponding IR elements)
do not have type parameters, we need to take them from the corresponding
property to ensure the correct IR for delegated property accessors.
This commit is contained in:
Alexander Udalov
2019-12-11 16:30:31 +03:00
parent 025360edc4
commit 5f367278c1
13 changed files with 452 additions and 29 deletions
@@ -85,6 +85,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/classes/dataClassesGeneric.kt");
}
@TestMetadata("delegatedGenericImplementation.kt")
public void testDelegatedGenericImplementation() throws Exception {
runTest("compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt");
}
@TestMetadata("delegatedImplementation.kt")
public void testDelegatedImplementation() throws Exception {
runTest("compiler/testData/ir/irText/classes/delegatedImplementation.kt");
@@ -42,6 +42,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRendererModifier
import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.propertyIfAccessor
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.types.KotlinType
@@ -320,41 +321,42 @@ class ClassGenerator(
return irBlockBody
}
private fun substituteOverriddenDescriptorForDelegate(
delegated: FunctionDescriptor,
overridden: FunctionDescriptor
): FunctionDescriptor {
// TODO PropertyAccessorDescriptor doesn't support 'substitute' right now :(
return if (overridden is PropertyAccessorDescriptor)
overridden
else {
val substitutor =
TypeSubstitutor.create(
overridden.typeParameters.associate {
val delegatedDefaultType = delegated.typeParameters[it.index].defaultType
it.typeConstructor to TypeProjectionImpl(delegatedDefaultType)
}
)
overridden.substitute(substitutor)!!
@Suppress("UNCHECKED_CAST")
private fun <D : CallableMemberDescriptor> substituteOverriddenDescriptorForDelegate(delegated: D, overridden: D): D =
// PropertyAccessorDescriptor doesn't support 'substitute' right now, so we substitute the corresponding property instead.
when (overridden) {
is PropertyGetterDescriptor -> substituteOverriddenDescriptorForDelegate(
(delegated as PropertyGetterDescriptor).correspondingProperty,
overridden.correspondingProperty
).getter as D
is PropertySetterDescriptor -> substituteOverriddenDescriptorForDelegate(
(delegated as PropertySetterDescriptor).correspondingProperty,
overridden.correspondingProperty
).setter as D
else -> {
val substitutor =
TypeSubstitutor.create(
overridden.typeParameters.associate {
val delegatedDefaultType = delegated.typeParameters[it.index].defaultType
it.typeConstructor to TypeProjectionImpl(delegatedDefaultType)
}
)
overridden.substitute(substitutor)!! as D
}
}
}
private fun getTypeArgumentsForOverriddenDescriptorDelegatingCall(
delegated: FunctionDescriptor,
overridden: FunctionDescriptor
): Map<TypeParameterDescriptor, KotlinType>? =
if (overridden.original.typeParameters.isEmpty())
null
else
zipTypeParametersToDefaultTypes(overridden.original, delegated)
): Map<TypeParameterDescriptor, KotlinType>? {
val keys = overridden.propertyIfAccessor.original.typeParameters
if (keys.isEmpty()) return null
private fun zipTypeParametersToDefaultTypes(
keys: FunctionDescriptor,
values: FunctionDescriptor
): Map<TypeParameterDescriptor, KotlinType> {
val typeArguments = newHashMapWithExpectedSize<TypeParameterDescriptor, KotlinType>(keys.typeParameters.size)
for ((i, overriddenTypeParameter) in keys.typeParameters.withIndex()) {
typeArguments[overriddenTypeParameter] = values.typeParameters[i].defaultType
val values = delegated.propertyIfAccessor.typeParameters
val typeArguments = newHashMapWithExpectedSize<TypeParameterDescriptor, KotlinType>(keys.size)
for ((i, overriddenTypeParameter) in keys.withIndex()) {
typeArguments[overriddenTypeParameter] = values[i].defaultType
}
return typeArguments
}
@@ -0,0 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface I {
val <T> T.id: T
get() = this
}
class A(i: I) : I by i
fun box(): String = with(A(object : I {})) { "OK".id }
@@ -0,0 +1,144 @@
FILE fqName:<root> fileName:/delegatedGenericImplementation.kt
CLASS INTERFACE name:IBase modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IBase
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?]
FUN name:foo visibility:public modality:ABSTRACT <B> ($this:<root>.IBase, a:A of <root>.IBase, b:B of <root>.IBase.foo) returnType:kotlin.Unit
TYPE_PARAMETER name:B index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase
VALUE_PARAMETER name:a index:0 type:A of <root>.IBase
VALUE_PARAMETER name:b index:1 type:B of <root>.IBase.foo
PROPERTY name:id visibility:public modality:ABSTRACT [val]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-id> visibility:public modality:ABSTRACT <> ($this:<root>.IBase) returnType:kotlin.collections.Map<A of <root>.IBase, C of <uninitialized parent>>?
correspondingProperty: PROPERTY name:id visibility:public modality:ABSTRACT [val]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase
PROPERTY name:x visibility:public modality:ABSTRACT [var]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:ABSTRACT <> ($this:<root>.IBase) returnType:D of <uninitialized parent>?
correspondingProperty: PROPERTY name:x visibility:public modality:ABSTRACT [var]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-x> visibility:public modality:ABSTRACT <> ($this:<root>.IBase, <set-?>:D of <uninitialized parent>?) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:x visibility:public modality:ABSTRACT [var]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase
VALUE_PARAMETER name:<set-?> index:0 type:D of <uninitialized parent>?
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[<root>.IBase<E of <root>.Test1>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test1
TYPE_PARAMETER name:E index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (i:<root>.IBase<E of <root>.Test1>) returnType:<root>.Test1<E of <root>.Test1> [primary]
VALUE_PARAMETER name:i index:0 type:<root>.IBase<E of <root>.Test1>
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[<root>.IBase<E of <root>.Test1>]'
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <B> ($this:<root>.IBase, a:E of <root>.Test1, b:B of <root>.Test1.foo) returnType:kotlin.Unit [fake_override]
overridden:
public abstract fun foo <B> (a: A of <root>.IBase, b: B of <root>.IBase.foo): kotlin.Unit declared in <root>.IBase
TYPE_PARAMETER name:B index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase
VALUE_PARAMETER name:a index:0 type:E of <root>.Test1
VALUE_PARAMETER name:b index:1 type:B of <root>.Test1.foo
PROPERTY FAKE_OVERRIDE name:id visibility:public modality:ABSTRACT [fake_override,val]
FUN FAKE_OVERRIDE name:<get-id> visibility:public modality:ABSTRACT <> ($this:<root>.Test1) returnType:kotlin.collections.Map<E of <root>.Test1, C of <uninitialized parent>>? [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:id visibility:public modality:ABSTRACT [fake_override,val]
overridden:
public abstract fun <get-id> (): kotlin.collections.Map<A of <root>.IBase, C of <uninitialized parent>>? declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test1
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:ABSTRACT [fake_override,var]
FUN FAKE_OVERRIDE name:<get-x> visibility:public modality:ABSTRACT <> ($this:<root>.Test1) returnType:D of <uninitialized parent>? [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:ABSTRACT [fake_override,var]
overridden:
public abstract fun <get-x> (): D of <uninitialized parent>? declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test1
FUN FAKE_OVERRIDE name:<set-x> visibility:public modality:ABSTRACT <> ($this:<root>.Test1, <set-?>:D of <uninitialized parent>?) returnType:kotlin.Unit [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:ABSTRACT [fake_override,var]
overridden:
public abstract fun <set-x> (<set-?>: D of <uninitialized parent>?): kotlin.Unit declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test1
VALUE_PARAMETER name:<set-?> index:0 type:D of <uninitialized parent>?
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[<root>.IBase<kotlin.String>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test2
CONSTRUCTOR visibility:public <> (j:<root>.IBase<kotlin.String>) returnType:<root>.Test2 [primary]
VALUE_PARAMETER name:j index:0 type:<root>.IBase<kotlin.String>
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[<root>.IBase<kotlin.String>]'
PROPERTY name:j visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private
EXPRESSION_BODY
GET_VAR 'j: <root>.IBase<kotlin.String> declared in <root>.Test2.<init>' type=<root>.IBase<kotlin.String> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-j> visibility:public modality:FINAL <> ($this:<root>.Test2) returnType:<root>.IBase<kotlin.String>
correspondingProperty: PROPERTY name:j visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-j> (): <root>.IBase<kotlin.String> declared in <root>.Test2'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private' type=<root>.IBase<kotlin.String> origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<get-j>' type=<root>.Test2 origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-j> visibility:public modality:FINAL <> ($this:<root>.Test2, <set-?>:<root>.IBase<kotlin.String>) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:j visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
VALUE_PARAMETER name:<set-?> index:0 type:<root>.IBase<kotlin.String>
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<set-j>' type=<root>.Test2 origin=null
value: GET_VAR '<set-?>: <root>.IBase<kotlin.String> declared in <root>.Test2.<set-j>' type=<root>.IBase<kotlin.String> origin=null
FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <B> ($this:<root>.IBase, a:kotlin.String, b:B of <root>.Test2.foo) returnType:kotlin.Unit [fake_override]
overridden:
public abstract fun foo <B> (a: A of <root>.IBase, b: B of <root>.IBase.foo): kotlin.Unit declared in <root>.IBase
TYPE_PARAMETER name:B index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase
VALUE_PARAMETER name:a index:0 type:kotlin.String
VALUE_PARAMETER name:b index:1 type:B of <root>.Test2.foo
PROPERTY FAKE_OVERRIDE name:id visibility:public modality:ABSTRACT [fake_override,val]
FUN FAKE_OVERRIDE name:<get-id> visibility:public modality:ABSTRACT <> ($this:<root>.Test2) returnType:kotlin.collections.Map<kotlin.String, C of <uninitialized parent>>? [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:id visibility:public modality:ABSTRACT [fake_override,val]
overridden:
public abstract fun <get-id> (): kotlin.collections.Map<A of <root>.IBase, C of <uninitialized parent>>? declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:ABSTRACT [fake_override,var]
FUN FAKE_OVERRIDE name:<get-x> visibility:public modality:ABSTRACT <> ($this:<root>.Test2) returnType:D of <uninitialized parent>? [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:ABSTRACT [fake_override,var]
overridden:
public abstract fun <get-x> (): D of <uninitialized parent>? declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
FUN FAKE_OVERRIDE name:<set-x> visibility:public modality:ABSTRACT <> ($this:<root>.Test2, <set-?>:D of <uninitialized parent>?) returnType:kotlin.Unit [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:ABSTRACT [fake_override,var]
overridden:
public abstract fun <set-x> (<set-?>: D of <uninitialized parent>?): kotlin.Unit declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
VALUE_PARAMETER name:<set-?> index:0 type:D of <uninitialized parent>?
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -0,0 +1,9 @@
interface IBase<A> {
fun <B> foo(a: A, b: B)
val <C> C.id: Map<A, C>?
var <D> List<D>.x: D?
}
class Test1<E>(i: IBase<E>) : IBase<E> by i
class Test2(var j: IBase<String>) : IBase<String> by j
@@ -0,0 +1,218 @@
FILE fqName:<root> fileName:/delegatedGenericImplementation.kt
CLASS INTERFACE name:IBase modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IBase<A of <root>.IBase>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?]
FUN name:foo visibility:public modality:ABSTRACT <B> ($this:<root>.IBase<A of <root>.IBase>, a:A of <root>.IBase, b:B of <root>.IBase.foo) returnType:kotlin.Unit
TYPE_PARAMETER name:B index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase<A of <root>.IBase>
VALUE_PARAMETER name:a index:0 type:A of <root>.IBase
VALUE_PARAMETER name:b index:1 type:B of <root>.IBase.foo
PROPERTY name:id visibility:public modality:ABSTRACT [val]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-id> visibility:public modality:ABSTRACT <C> ($this:<root>.IBase<A of <root>.IBase>, $receiver:C of <root>.IBase.<get-id>) returnType:kotlin.collections.Map<A of <root>.IBase, C of <root>.IBase.<get-id>>?
correspondingProperty: PROPERTY name:id visibility:public modality:ABSTRACT [val]
TYPE_PARAMETER name:C index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase<A of <root>.IBase>
$receiver: VALUE_PARAMETER name:<this> type:C of <root>.IBase.<get-id>
PROPERTY name:x visibility:public modality:ABSTRACT [var]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:ABSTRACT <D> ($this:<root>.IBase<A of <root>.IBase>, $receiver:kotlin.collections.List<D of <root>.IBase.<get-x>>) returnType:D of <root>.IBase.<get-x>?
correspondingProperty: PROPERTY name:x visibility:public modality:ABSTRACT [var]
TYPE_PARAMETER name:D index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase<A of <root>.IBase>
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.IBase.<get-x>>
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-x> visibility:public modality:ABSTRACT <D> ($this:<root>.IBase<A of <root>.IBase>, $receiver:kotlin.collections.List<D of <root>.IBase.<set-x>>, <set-?>:D of <root>.IBase.<set-x>?) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:x visibility:public modality:ABSTRACT [var]
TYPE_PARAMETER name:D index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.IBase<A of <root>.IBase>
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.IBase.<set-x>>
VALUE_PARAMETER name:<set-?> index:0 type:D of <root>.IBase.<set-x>?
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[<root>.IBase<E of <root>.Test1>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test1<E of <root>.Test1>
TYPE_PARAMETER name:E index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (i:<root>.IBase<E of <root>.Test1>) returnType:<root>.Test1<E of <root>.Test1> [primary]
VALUE_PARAMETER name:i index:0 type:<root>.IBase<E of <root>.Test1>
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[<root>.IBase<E of <root>.Test1>]'
FIELD DELEGATE name:Test1$IBase$delegate type:<root>.IBase<E of <root>.Test1> visibility:private [final]
EXPRESSION_BODY
GET_VAR 'i: <root>.IBase<E of <root>.Test1> declared in <root>.Test1.<init>' type=<root>.IBase<E of <root>.Test1> origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <B> ($this:<root>.Test1<E of <root>.Test1>, a:E of <root>.Test1, b:B of <root>.Test1.foo) returnType:kotlin.Unit
overridden:
public abstract fun foo <B> (a: A of <root>.IBase, b: B of <root>.IBase.foo): kotlin.Unit declared in <root>.IBase
TYPE_PARAMETER name:B index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.Test1<E of <root>.Test1>
VALUE_PARAMETER name:a index:0 type:E of <root>.Test1
VALUE_PARAMETER name:b index:1 type:B of <root>.Test1.foo
BLOCK_BODY
CALL 'public abstract fun foo <B> (a: A of <root>.IBase, b: B of <root>.IBase.foo): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
<B>: B of <root>.Test1.foo
$this: GET_FIELD 'FIELD DELEGATE name:Test1$IBase$delegate type:<root>.IBase<E of <root>.Test1> visibility:private [final]' type=<root>.IBase<E of <root>.Test1> origin=null
receiver: GET_VAR '<this>: <root>.Test1<E of <root>.Test1> declared in <root>.Test1.foo' type=<root>.Test1<E of <root>.Test1> origin=null
a: GET_VAR 'a: E of <root>.Test1 declared in <root>.Test1.foo' type=E of <root>.Test1 origin=null
b: GET_VAR 'b: B of <root>.Test1.foo declared in <root>.Test1.foo' type=B of <root>.Test1.foo origin=null
PROPERTY DELEGATED_MEMBER name:id visibility:public modality:OPEN [val]
FUN DELEGATED_MEMBER name:<get-id> visibility:public modality:OPEN <> ($this:<root>.Test1<E of <root>.Test1>, $receiver:C of <root>.Test1.<get-id>) returnType:kotlin.collections.Map<E of <root>.Test1, C of <root>.Test1.<get-id>>?
correspondingProperty: PROPERTY DELEGATED_MEMBER name:id visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-id> <C> (): kotlin.collections.Map<A of <root>.IBase, C of <root>.IBase.<get-id>>? declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test1<E of <root>.Test1>
$receiver: VALUE_PARAMETER name:<this> type:C of <root>.Test1.<get-id>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-id> (): kotlin.collections.Map<E of <root>.Test1, C of <root>.Test1.<get-id>>? declared in <root>.Test1'
CALL 'public abstract fun <get-id> <C> (): kotlin.collections.Map<A of <root>.IBase, C of <root>.IBase.<get-id>>? declared in <root>.IBase' type=kotlin.collections.Map<E of <root>.Test1, C of <root>.Test1.<get-id>>? origin=null
<C>: C of <root>.Test1.<get-id>
$this: GET_FIELD 'FIELD DELEGATE name:Test1$IBase$delegate type:<root>.IBase<E of <root>.Test1> visibility:private [final]' type=<root>.IBase<E of <root>.Test1> origin=null
receiver: GET_VAR '<this>: <root>.Test1<E of <root>.Test1> declared in <root>.Test1.<get-id>' type=<root>.Test1<E of <root>.Test1> origin=null
$receiver: GET_VAR '<this>: C of <root>.Test1.<get-id> declared in <root>.Test1.<get-id>' type=C of <root>.Test1.<get-id> origin=null
PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
FUN DELEGATED_MEMBER name:<get-x> visibility:public modality:OPEN <> ($this:<root>.Test1<E of <root>.Test1>, $receiver:kotlin.collections.List<D of <root>.Test1.<get-x>>) returnType:D of <root>.Test1.<get-x>?
correspondingProperty: PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
overridden:
public abstract fun <get-x> <D> (): D of <root>.IBase.<get-x>? declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test1<E of <root>.Test1>
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.Test1.<get-x>>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-x> (): D of <root>.Test1.<get-x>? declared in <root>.Test1'
CALL 'public abstract fun <get-x> <D> (): D of <root>.IBase.<get-x>? declared in <root>.IBase' type=D of <root>.Test1.<get-x>? origin=null
<D>: D of <root>.Test1.<get-x>
$this: GET_FIELD 'FIELD DELEGATE name:Test1$IBase$delegate type:<root>.IBase<E of <root>.Test1> visibility:private [final]' type=<root>.IBase<E of <root>.Test1> origin=null
receiver: GET_VAR '<this>: <root>.Test1<E of <root>.Test1> declared in <root>.Test1.<get-x>' type=<root>.Test1<E of <root>.Test1> origin=null
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test1.<get-x>> declared in <root>.Test1.<get-x>' type=kotlin.collections.List<D of <root>.Test1.<get-x>> origin=null
FUN DELEGATED_MEMBER name:<set-x> visibility:public modality:OPEN <> ($this:<root>.Test1<E of <root>.Test1>, $receiver:kotlin.collections.List<D of <root>.Test1.<get-x>>, <set-?>:D of <root>.Test1.<get-x>?) returnType:kotlin.Unit
correspondingProperty: PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
overridden:
public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test1<E of <root>.Test1>
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.Test1.<get-x>>
VALUE_PARAMETER name:<set-?> index:0 type:D of <root>.Test1.<get-x>?
BLOCK_BODY
CALL 'public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
<D>: D of <root>.Test1.<get-x>
$this: GET_FIELD 'FIELD DELEGATE name:Test1$IBase$delegate type:<root>.IBase<E of <root>.Test1> visibility:private [final]' type=<root>.IBase<E of <root>.Test1> origin=null
receiver: GET_VAR '<this>: <root>.Test1<E of <root>.Test1> declared in <root>.Test1.<set-x>' type=<root>.Test1<E of <root>.Test1> origin=null
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test1.<get-x>> declared in <root>.Test1.<set-x>' type=kotlin.collections.List<D of <root>.Test1.<get-x>> origin=null
<set-?>: GET_VAR '<set-?>: D of <root>.Test1.<get-x>? declared in <root>.Test1.<set-x>' type=D of <root>.Test1.<get-x>? origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[<root>.IBase<kotlin.String>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test2
CONSTRUCTOR visibility:public <> (j:<root>.IBase<kotlin.String>) returnType:<root>.Test2 [primary]
VALUE_PARAMETER name:j index:0 type:<root>.IBase<kotlin.String>
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[<root>.IBase<kotlin.String>]'
PROPERTY name:j visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private
EXPRESSION_BODY
GET_VAR 'j: <root>.IBase<kotlin.String> declared in <root>.Test2.<init>' type=<root>.IBase<kotlin.String> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-j> visibility:public modality:FINAL <> ($this:<root>.Test2) returnType:<root>.IBase<kotlin.String>
correspondingProperty: PROPERTY name:j visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-j> (): <root>.IBase<kotlin.String> declared in <root>.Test2'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private' type=<root>.IBase<kotlin.String> origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<get-j>' type=<root>.Test2 origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-j> visibility:public modality:FINAL <> ($this:<root>.Test2, <set-?>:<root>.IBase<kotlin.String>) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:j visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
VALUE_PARAMETER name:<set-?> index:0 type:<root>.IBase<kotlin.String>
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:<root>.IBase<kotlin.String> visibility:private' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<set-j>' type=<root>.Test2 origin=null
value: GET_VAR '<set-?>: <root>.IBase<kotlin.String> declared in <root>.Test2.<set-j>' type=<root>.IBase<kotlin.String> origin=null
FIELD DELEGATE name:Test2$IBase$delegate type:<root>.IBase<kotlin.String> visibility:private [final]
EXPRESSION_BODY
GET_VAR 'j: <root>.IBase<kotlin.String> declared in <root>.Test2.<init>' type=<root>.IBase<kotlin.String> origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <B> ($this:<root>.Test2, a:kotlin.String, b:B of <root>.Test2.foo) returnType:kotlin.Unit
overridden:
public abstract fun foo <B> (a: A of <root>.IBase, b: B of <root>.IBase.foo): kotlin.Unit declared in <root>.IBase
TYPE_PARAMETER name:B index:0 variance: superTypes:[kotlin.Any?]
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
VALUE_PARAMETER name:a index:0 type:kotlin.String
VALUE_PARAMETER name:b index:1 type:B of <root>.Test2.foo
BLOCK_BODY
CALL 'public abstract fun foo <B> (a: A of <root>.IBase, b: B of <root>.IBase.foo): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
<B>: B of <root>.Test2.foo
$this: GET_FIELD 'FIELD DELEGATE name:Test2$IBase$delegate type:<root>.IBase<kotlin.String> visibility:private [final]' type=<root>.IBase<kotlin.String> origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.foo' type=<root>.Test2 origin=null
a: GET_VAR 'a: kotlin.String declared in <root>.Test2.foo' type=kotlin.String origin=null
b: GET_VAR 'b: B of <root>.Test2.foo declared in <root>.Test2.foo' type=B of <root>.Test2.foo origin=null
PROPERTY DELEGATED_MEMBER name:id visibility:public modality:OPEN [val]
FUN DELEGATED_MEMBER name:<get-id> visibility:public modality:OPEN <> ($this:<root>.Test2, $receiver:C of <root>.Test2.<get-id>) returnType:kotlin.collections.Map<kotlin.String, C of <root>.Test2.<get-id>>?
correspondingProperty: PROPERTY DELEGATED_MEMBER name:id visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-id> <C> (): kotlin.collections.Map<A of <root>.IBase, C of <root>.IBase.<get-id>>? declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
$receiver: VALUE_PARAMETER name:<this> type:C of <root>.Test2.<get-id>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-id> (): kotlin.collections.Map<kotlin.String, C of <root>.Test2.<get-id>>? declared in <root>.Test2'
CALL 'public abstract fun <get-id> <C> (): kotlin.collections.Map<A of <root>.IBase, C of <root>.IBase.<get-id>>? declared in <root>.IBase' type=kotlin.collections.Map<kotlin.String, C of <root>.Test2.<get-id>>? origin=null
<C>: C of <root>.Test2.<get-id>
$this: GET_FIELD 'FIELD DELEGATE name:Test2$IBase$delegate type:<root>.IBase<kotlin.String> visibility:private [final]' type=<root>.IBase<kotlin.String> origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<get-id>' type=<root>.Test2 origin=null
$receiver: GET_VAR '<this>: C of <root>.Test2.<get-id> declared in <root>.Test2.<get-id>' type=C of <root>.Test2.<get-id> origin=null
PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
FUN DELEGATED_MEMBER name:<get-x> visibility:public modality:OPEN <> ($this:<root>.Test2, $receiver:kotlin.collections.List<D of <root>.Test2.<get-x>>) returnType:D of <root>.Test2.<get-x>?
correspondingProperty: PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
overridden:
public abstract fun <get-x> <D> (): D of <root>.IBase.<get-x>? declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.Test2.<get-x>>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-x> (): D of <root>.Test2.<get-x>? declared in <root>.Test2'
CALL 'public abstract fun <get-x> <D> (): D of <root>.IBase.<get-x>? declared in <root>.IBase' type=D of <root>.Test2.<get-x>? origin=null
<D>: D of <root>.Test2.<get-x>
$this: GET_FIELD 'FIELD DELEGATE name:Test2$IBase$delegate type:<root>.IBase<kotlin.String> visibility:private [final]' type=<root>.IBase<kotlin.String> origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<get-x>' type=<root>.Test2 origin=null
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test2.<get-x>> declared in <root>.Test2.<get-x>' type=kotlin.collections.List<D of <root>.Test2.<get-x>> origin=null
FUN DELEGATED_MEMBER name:<set-x> visibility:public modality:OPEN <> ($this:<root>.Test2, $receiver:kotlin.collections.List<D of <root>.Test2.<get-x>>, <set-?>:D of <root>.Test2.<get-x>?) returnType:kotlin.Unit
correspondingProperty: PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [var]
overridden:
public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test2
$receiver: VALUE_PARAMETER name:<this> type:kotlin.collections.List<D of <root>.Test2.<get-x>>
VALUE_PARAMETER name:<set-?> index:0 type:D of <root>.Test2.<get-x>?
BLOCK_BODY
CALL 'public abstract fun <set-x> <D> (<set-?>: D of <root>.IBase.<set-x>?): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
<D>: D of <root>.Test2.<get-x>
$this: GET_FIELD 'FIELD DELEGATE name:Test2$IBase$delegate type:<root>.IBase<kotlin.String> visibility:private [final]' type=<root>.IBase<kotlin.String> origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<set-x>' type=<root>.Test2 origin=null
$receiver: GET_VAR '<this>: kotlin.collections.List<D of <root>.Test2.<get-x>> declared in <root>.Test2.<set-x>' type=kotlin.collections.List<D of <root>.Test2.<get-x>> origin=null
<set-?>: GET_VAR '<set-?>: D of <root>.Test2.<get-x>? declared in <root>.Test2.<set-x>' type=D of <root>.Test2.<get-x>? origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -9952,6 +9952,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/delegation/diamond2.kt");
}
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericProperty.kt");
}
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
public void testHiddenSuperOverrideIn1_0() throws Exception {
runTest("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");
@@ -9957,6 +9957,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/delegation/diamond2.kt");
}
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericProperty.kt");
}
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
public void testHiddenSuperOverrideIn1_0() throws Exception {
runTest("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");
@@ -8802,6 +8802,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/delegation/diamond2.kt");
}
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericProperty.kt");
}
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
public void testHiddenSuperOverrideIn1_0() throws Exception {
runTest("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");
@@ -8802,6 +8802,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/delegation/diamond2.kt");
}
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericProperty.kt");
}
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
public void testHiddenSuperOverrideIn1_0() throws Exception {
runTest("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");
@@ -85,6 +85,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
runTest("compiler/testData/ir/irText/classes/dataClassesGeneric.kt");
}
@TestMetadata("delegatedGenericImplementation.kt")
public void testDelegatedGenericImplementation() throws Exception {
runTest("compiler/testData/ir/irText/classes/delegatedGenericImplementation.kt");
}
@TestMetadata("delegatedImplementation.kt")
public void testDelegatedImplementation() throws Exception {
runTest("compiler/testData/ir/irText/classes/delegatedImplementation.kt");
@@ -7617,6 +7617,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt");
}
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericProperty.kt");
}
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
public void testHiddenSuperOverrideIn1_0() throws Exception {
runTest("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");
@@ -8692,6 +8692,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt");
}
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericProperty.kt");
}
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
public void testHiddenSuperOverrideIn1_0() throws Exception {
runTest("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");