[FIR2IR] Erasure type of parameter of delegated property in K1 manner

Add `shouldEraseType` to `Fir2IrConversionScope`

^KT-62884 Fixed
This commit is contained in:
Ivan Kochurkin
2024-01-25 23:41:31 +01:00
committed by Space Team
parent e55acf56fa
commit 968ecadff2
19 changed files with 550 additions and 120 deletions
@@ -0,0 +1,169 @@
FILE fqName:<root> fileName:/typeParameterInDelegatedProperty.kt
CLASS INTERFACE name:IDelegate modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IDelegate<T of <root>.IDelegate>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
FUN name:getValue visibility:public modality:ABSTRACT <> ($this:<root>.IDelegate<T of <root>.IDelegate>, t:T of <root>.IDelegate, p:kotlin.reflect.KProperty<*>) returnType:T of <root>.IDelegate [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.IDelegate<T of <root>.IDelegate>
VALUE_PARAMETER name:t index:0 type:T of <root>.IDelegate
VALUE_PARAMETER name:p index:1 type:kotlin.reflect.KProperty<*>
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 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
PROPERTY name:property visibility:public modality:FINAL [delegated,val]
FIELD PROPERTY_DELEGATE name:property$delegate type:<root>.property$delegate.<no name provided><T of <root>.<get-property>> visibility:private [final,static]
EXPRESSION_BODY
BLOCK type=<root>.property$delegate.<no name provided><T of <root>.<get-property>> origin=OBJECT_LITERAL
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.IDelegate<kotlin.Any?>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.property$delegate.<no name provided><T of <root>.<get-property>>
CONSTRUCTOR visibility:public <> () returnType:<root>.property$delegate.<no name provided><kotlin.Any?> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.IDelegate<kotlin.Any?>]'
FUN name:getValue visibility:public modality:OPEN <> ($this:<root>.property$delegate.<no name provided><T of <root>.<get-property>>, t:kotlin.Any?, p:kotlin.reflect.KProperty<*>) returnType:kotlin.Any? [operator]
overridden:
public abstract fun getValue (t: T of <root>.IDelegate, p: kotlin.reflect.KProperty<*>): T of <root>.IDelegate declared in <root>.IDelegate
$this: VALUE_PARAMETER name:<this> type:<root>.property$delegate.<no name provided><T of <root>.<get-property>>
VALUE_PARAMETER name:t index:0 type:kotlin.Any?
VALUE_PARAMETER name:p index:1 type:kotlin.reflect.KProperty<*>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun getValue (t: kotlin.Any?, p: kotlin.reflect.KProperty<*>): kotlin.Any? declared in <root>.property$delegate.<no name provided>'
GET_VAR 't: kotlin.Any? declared in <root>.property$delegate.<no name provided>.getValue' type=kotlin.Any? 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 declared in <root>.IDelegate
$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 <root>.IDelegate
$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 <root>.IDelegate
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.property$delegate.<no name provided>' type=<root>.property$delegate.<no name provided><T of <root>.<get-property>> origin=OBJECT_LITERAL
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-property> visibility:public modality:FINAL <T> ($receiver:T of <root>.<get-property>) returnType:T of <root>.<get-property>
correspondingProperty: PROPERTY name:property visibility:public modality:FINAL [delegated,val]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.<get-property>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-property> <T> (): T of <root>.<get-property> declared in <root>'
CALL 'public open fun getValue (t: kotlin.Any?, p: kotlin.reflect.KProperty<*>): kotlin.Any? declared in <root>.property$delegate.<no name provided>' type=T of <root>.<get-property> origin=null
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:property$delegate type:<root>.property$delegate.<no name provided><T of <root>.<get-property>> visibility:private [final,static]' type=<root>.property$delegate.<no name provided><T of <root>.<get-property>> origin=null
t: GET_VAR '<this>: T of <root>.<get-property> declared in <root>.<get-property>' type=T of <root>.<get-property> origin=null
p: PROPERTY_REFERENCE 'public final property: T of <root>.<get-property>' field=null getter='public final fun <get-property> <T> (): T of <root>.<get-property> declared in <root>' setter=null type=kotlin.reflect.KProperty1<T of <root>.<get-property>, T of <root>.<get-property>> origin=PROPERTY_REFERENCE_FOR_DELEGATE
<1>: T of <root>.<get-property>
PROPERTY name:property2 visibility:public modality:FINAL [delegated,val]
FIELD PROPERTY_DELEGATE name:property2$delegate type:<root>.IDelegate<T of <root>.<get-property2>> visibility:private [final,static]
EXPRESSION_BODY
CALL 'public final fun run <R> (block: kotlin.Function0<R of kotlin.run>): R of kotlin.run declared in kotlin' type=<root>.IDelegate<T of <root>.<get-property2>> origin=null
<R>: <root>.IDelegate<T of <root>.<get-property2>>
block: FUN_EXPR type=kotlin.Function0<<root>.IDelegate<T of <root>.<get-property2>>> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.IDelegate<T of <root>.<get-property2>>
BLOCK_BODY
FUN LOCAL_FUNCTION name:test visibility:local modality:FINAL <> (t:T of <root>.<get-property2>) returnType:T of <root>.<get-property2>
VALUE_PARAMETER name:t index:0 type:T of <root>.<get-property2>
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun test (t: T of <root>.<get-property2>): T of <root>.<get-property2> declared in <root>.property2$delegate.<anonymous>'
GET_VAR 't: T of <root>.<get-property2> declared in <root>.property2$delegate.<anonymous>.test' type=T of <root>.<get-property2> origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): <root>.IDelegate<T of <root>.<get-property2>> declared in <root>.property2$delegate'
BLOCK type=<root>.property2$delegate.<anonymous>.<no name provided><T of <root>.<get-property2>> origin=OBJECT_LITERAL
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.IDelegate<kotlin.Any?>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.property2$delegate.<anonymous>.<no name provided><T of <root>.<get-property2>>
CONSTRUCTOR visibility:public <> () returnType:<root>.property2$delegate.<anonymous>.<no name provided><kotlin.Any?> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.IDelegate<kotlin.Any?>]'
FUN name:getValue visibility:public modality:OPEN <> ($this:<root>.property2$delegate.<anonymous>.<no name provided><T of <root>.<get-property2>>, t:kotlin.Any?, p:kotlin.reflect.KProperty<*>) returnType:kotlin.Any? [operator]
overridden:
public abstract fun getValue (t: T of <root>.IDelegate, p: kotlin.reflect.KProperty<*>): T of <root>.IDelegate declared in <root>.IDelegate
$this: VALUE_PARAMETER name:<this> type:<root>.property2$delegate.<anonymous>.<no name provided><T of <root>.<get-property2>>
VALUE_PARAMETER name:t index:0 type:kotlin.Any?
VALUE_PARAMETER name:p index:1 type:kotlin.reflect.KProperty<*>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun getValue (t: kotlin.Any?, p: kotlin.reflect.KProperty<*>): kotlin.Any? declared in <root>.property2$delegate.<anonymous>.<no name provided>'
CALL 'local final fun test (t: T of <root>.<get-property2>): T of <root>.<get-property2> declared in <root>.property2$delegate.<anonymous>' type=kotlin.Any? origin=null
t: GET_VAR 't: kotlin.Any? declared in <root>.property2$delegate.<anonymous>.<no name provided>.getValue' type=kotlin.Any? 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 declared in <root>.IDelegate
$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 <root>.IDelegate
$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 <root>.IDelegate
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.property2$delegate.<anonymous>.<no name provided>' type=<root>.property2$delegate.<anonymous>.<no name provided><T of <root>.<get-property2>> origin=OBJECT_LITERAL
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-property2> visibility:public modality:FINAL <T> ($receiver:T of <root>.<get-property2>) returnType:T of <root>.<get-property2>
correspondingProperty: PROPERTY name:property2 visibility:public modality:FINAL [delegated,val]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.<get-property2>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-property2> <T> (): T of <root>.<get-property2> declared in <root>'
CALL 'public abstract fun getValue (t: T of <root>.IDelegate, p: kotlin.reflect.KProperty<*>): T of <root>.IDelegate declared in <root>.IDelegate' type=T of <root>.<get-property2> origin=null
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:property2$delegate type:<root>.IDelegate<T of <root>.<get-property2>> visibility:private [final,static]' type=<root>.IDelegate<T of <root>.<get-property2>> origin=null
t: GET_VAR '<this>: T of <root>.<get-property2> declared in <root>.<get-property2>' type=T of <root>.<get-property2> origin=null
p: PROPERTY_REFERENCE 'public final property2: T of <root>.<get-property2>' field=null getter='public final fun <get-property2> <T> (): T of <root>.<get-property2> declared in <root>' setter=null type=kotlin.reflect.KProperty1<T of <root>.<get-property2>, T of <root>.<get-property2>> origin=PROPERTY_REFERENCE_FOR_DELEGATE
<1>: T of <root>.<get-property2>
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:superInterfaces type:kotlin.Array<java.lang.reflect.Type> [val]
TYPE_OP type=@[FlexibleArrayElementVariance] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?> origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleArrayElementVariance] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>
CALL 'public open fun getGenericInterfaces (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>? declared in java.lang.Class' type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>? origin=null
$this: CALL 'public open fun forName (p0: @[FlexibleNullability] kotlin.String?): @[FlexibleNullability] java.lang.Class<*>? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.Class<*>? origin=null
p0: CONST String type=kotlin.String value="TypeParameterInDelegatedPropertyKt$property$2"
WHEN type=kotlin.Unit origin=IF
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=null
$this: CALL 'public final fun contains (other: kotlin.CharSequence, ignoreCase: kotlin.Boolean): kotlin.Boolean declared in kotlin.text' type=kotlin.Boolean origin=null
$receiver: CALL 'public open fun toString (): kotlin.String declared in java.lang.reflect.Type' type=kotlin.String origin=null
$this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=java.lang.reflect.Type origin=GET_ARRAY_ELEMENT
$this: GET_VAR 'val superInterfaces: kotlin.Array<java.lang.reflect.Type> declared in <root>.box' type=kotlin.Array<java.lang.reflect.Type> origin=null
index: CONST Int type=kotlin.Int value=0
other: CONST String type=kotlin.String value="IDelegate<java.lang.Object>"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="FAIL"
VAR name:superInterfaces2 type:kotlin.Array<java.lang.reflect.Type> [val]
TYPE_OP type=@[FlexibleArrayElementVariance] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?> origin=IMPLICIT_NOTNULL typeOperand=@[FlexibleArrayElementVariance] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>
CALL 'public open fun getGenericInterfaces (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>? declared in java.lang.Class' type=@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>? origin=null
$this: CALL 'public open fun forName (p0: @[FlexibleNullability] kotlin.String?): @[FlexibleNullability] java.lang.Class<*>? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.Class<*>? origin=null
p0: CONST String type=kotlin.String value="TypeParameterInDelegatedPropertyKt$property2$2$1"
WHEN type=kotlin.Unit origin=IF
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=null
$this: CALL 'public final fun contains (other: kotlin.CharSequence, ignoreCase: kotlin.Boolean): kotlin.Boolean declared in kotlin.text' type=kotlin.Boolean origin=null
$receiver: CALL 'public open fun toString (): kotlin.String declared in java.lang.reflect.Type' type=kotlin.String origin=null
$this: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=java.lang.reflect.Type origin=GET_ARRAY_ELEMENT
$this: GET_VAR 'val superInterfaces2: kotlin.Array<java.lang.reflect.Type> declared in <root>.box' type=kotlin.Array<java.lang.reflect.Type> origin=null
index: CONST Int type=kotlin.Int value=0
other: CONST String type=kotlin.String value="IDelegate<java.lang.Object>"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="FAIL"
WHEN type=kotlin.Unit origin=IF
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'public final fun <get-property2> <T> (): T of <root>.<get-property2> declared in <root>' type=kotlin.String origin=GET_PROPERTY
<T>: kotlin.String
$receiver: CONST String type=kotlin.String value="OK"
arg1: CONST String type=kotlin.String value="OK"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="FAIL"
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="OK"
@@ -0,0 +1,175 @@
FILE fqName:<root> fileName:/typeParameterInDelegatedProperty.kt
CLASS INTERFACE name:IDelegate modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IDelegate<T of <root>.IDelegate>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
FUN name:getValue visibility:public modality:ABSTRACT <> ($this:<root>.IDelegate<T of <root>.IDelegate>, t:T of <root>.IDelegate, p:kotlin.reflect.KProperty<*>) returnType:T of <root>.IDelegate [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.IDelegate<T of <root>.IDelegate>
VALUE_PARAMETER name:t index:0 type:T of <root>.IDelegate
VALUE_PARAMETER name:p index:1 type:kotlin.reflect.KProperty<*>
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 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
PROPERTY name:property visibility:public modality:FINAL [delegated,val]
FIELD PROPERTY_DELEGATE name:property$delegate type:<root>.property$delegate.<no name provided><kotlin.Any?> visibility:private [final,static]
EXPRESSION_BODY
BLOCK type=<root>.property$delegate.<no name provided><kotlin.Any?> origin=OBJECT_LITERAL
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.IDelegate<kotlin.Any?>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.property$delegate.<no name provided><kotlin.Any?>
CONSTRUCTOR visibility:public <> () returnType:<root>.property$delegate.<no name provided><kotlin.Any?> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.IDelegate<kotlin.Any?>]'
FUN name:getValue visibility:public modality:OPEN <> ($this:<root>.property$delegate.<no name provided><kotlin.Any?>, t:kotlin.Any?, p:kotlin.reflect.KProperty<*>) returnType:kotlin.Any? [operator]
overridden:
public abstract fun getValue (t: T of <root>.IDelegate, p: kotlin.reflect.KProperty<*>): T of <root>.IDelegate declared in <root>.IDelegate
$this: VALUE_PARAMETER name:<this> type:<root>.property$delegate.<no name provided><kotlin.Any?>
VALUE_PARAMETER name:t index:0 type:kotlin.Any?
VALUE_PARAMETER name:p index:1 type:kotlin.reflect.KProperty<*>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun getValue (t: kotlin.Any?, p: kotlin.reflect.KProperty<*>): kotlin.Any? declared in <root>.property$delegate.<no name provided>'
TYPE_OP type=kotlin.Any? origin=IMPLICIT_CAST typeOperand=kotlin.Any?
GET_VAR 't: kotlin.Any? declared in <root>.property$delegate.<no name provided>.getValue' type=kotlin.Any? 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 declared in <root>.IDelegate
$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 <root>.IDelegate
$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 <root>.IDelegate
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.property$delegate.<no name provided>' type=<root>.property$delegate.<no name provided><kotlin.Any?> origin=OBJECT_LITERAL
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-property> visibility:public modality:FINAL <T> ($receiver:T of <root>.<get-property>) returnType:T of <root>.<get-property>
correspondingProperty: PROPERTY name:property visibility:public modality:FINAL [delegated,val]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.<get-property>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-property> <T> (): T of <root>.<get-property> declared in <root>'
CALL 'public open fun getValue (t: kotlin.Any?, p: kotlin.reflect.KProperty<*>): kotlin.Any? declared in <root>.property$delegate.<no name provided>' type=T of <root>.<get-property> origin=null
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:property$delegate type:<root>.property$delegate.<no name provided><kotlin.Any?> visibility:private [final,static]' type=<root>.property$delegate.<no name provided><kotlin.Any?> origin=null
t: GET_VAR '<this>: T of <root>.<get-property> declared in <root>.<get-property>' type=T of <root>.<get-property> origin=null
p: PROPERTY_REFERENCE 'public final property: T of <root>.<get-property>' field=null getter='public final fun <get-property> <T> (): T of <root>.<get-property> declared in <root>' setter=null type=kotlin.reflect.KProperty1<T of <root>.<get-property>, T of <root>.<get-property>> origin=PROPERTY_REFERENCE_FOR_DELEGATE
<1>: T of <root>.<get-property>
PROPERTY name:property2 visibility:public modality:FINAL [delegated,val]
FIELD PROPERTY_DELEGATE name:property2$delegate type:<root>.IDelegate<kotlin.Any?> visibility:private [final,static]
EXPRESSION_BODY
CALL 'public final fun run <R> (block: kotlin.Function0<R of kotlin.run>): R of kotlin.run declared in kotlin' type=<root>.IDelegate<kotlin.Any?> origin=null
<R>: <root>.IDelegate<kotlin.Any?>
block: FUN_EXPR type=kotlin.Function0<<root>.IDelegate<kotlin.Any?>> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.IDelegate<kotlin.Any?>
BLOCK_BODY
FUN LOCAL_FUNCTION name:test visibility:local modality:FINAL <> (t:kotlin.Any?) returnType:kotlin.Any?
VALUE_PARAMETER name:t index:0 type:kotlin.Any?
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun test (t: kotlin.Any?): kotlin.Any? declared in <root>.property2$delegate.<anonymous>'
TYPE_OP type=kotlin.Any? origin=IMPLICIT_CAST typeOperand=kotlin.Any?
GET_VAR 't: kotlin.Any? declared in <root>.property2$delegate.<anonymous>.test' type=kotlin.Any? origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): <root>.IDelegate<kotlin.Any?> declared in <root>.property2$delegate'
BLOCK type=<root>.property2$delegate.<anonymous>.<no name provided><kotlin.Any?> origin=OBJECT_LITERAL
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.IDelegate<kotlin.Any?>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.property2$delegate.<anonymous>.<no name provided><kotlin.Any?>
CONSTRUCTOR visibility:public <> () returnType:<root>.property2$delegate.<anonymous>.<no name provided><kotlin.Any?> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.IDelegate<kotlin.Any?>]'
FUN name:getValue visibility:public modality:OPEN <> ($this:<root>.property2$delegate.<anonymous>.<no name provided><kotlin.Any?>, t:kotlin.Any?, p:kotlin.reflect.KProperty<*>) returnType:kotlin.Any? [operator]
overridden:
public abstract fun getValue (t: T of <root>.IDelegate, p: kotlin.reflect.KProperty<*>): T of <root>.IDelegate declared in <root>.IDelegate
$this: VALUE_PARAMETER name:<this> type:<root>.property2$delegate.<anonymous>.<no name provided><kotlin.Any?>
VALUE_PARAMETER name:t index:0 type:kotlin.Any?
VALUE_PARAMETER name:p index:1 type:kotlin.reflect.KProperty<*>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun getValue (t: kotlin.Any?, p: kotlin.reflect.KProperty<*>): kotlin.Any? declared in <root>.property2$delegate.<anonymous>.<no name provided>'
TYPE_OP type=kotlin.Any? origin=IMPLICIT_CAST typeOperand=kotlin.Any?
CALL 'local final fun test (t: kotlin.Any?): kotlin.Any? declared in <root>.property2$delegate.<anonymous>' type=kotlin.Any? origin=null
t: TYPE_OP type=kotlin.Any? origin=IMPLICIT_CAST typeOperand=kotlin.Any?
GET_VAR 't: kotlin.Any? declared in <root>.property2$delegate.<anonymous>.<no name provided>.getValue' type=kotlin.Any? 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 declared in <root>.IDelegate
$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 <root>.IDelegate
$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 <root>.IDelegate
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.property2$delegate.<anonymous>.<no name provided>' type=<root>.property2$delegate.<anonymous>.<no name provided><kotlin.Any?> origin=OBJECT_LITERAL
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-property2> visibility:public modality:FINAL <T> ($receiver:T of <root>.<get-property2>) returnType:T of <root>.<get-property2>
correspondingProperty: PROPERTY name:property2 visibility:public modality:FINAL [delegated,val]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.<get-property2>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-property2> <T> (): T of <root>.<get-property2> declared in <root>'
CALL 'public abstract fun getValue (t: T of <root>.IDelegate, p: kotlin.reflect.KProperty<*>): T of <root>.IDelegate declared in <root>.IDelegate' type=T of <root>.<get-property2> origin=null
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:property2$delegate type:<root>.IDelegate<kotlin.Any?> visibility:private [final,static]' type=<root>.IDelegate<kotlin.Any?> origin=null
t: GET_VAR '<this>: T of <root>.<get-property2> declared in <root>.<get-property2>' type=T of <root>.<get-property2> origin=null
p: PROPERTY_REFERENCE 'public final property2: T of <root>.<get-property2>' field=null getter='public final fun <get-property2> <T> (): T of <root>.<get-property2> declared in <root>' setter=null type=kotlin.reflect.KProperty1<T of <root>.<get-property2>, T of <root>.<get-property2>> origin=PROPERTY_REFERENCE_FOR_DELEGATE
<1>: T of <root>.<get-property2>
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:superInterfaces type:kotlin.Array<java.lang.reflect.Type> [val]
TYPE_OP type=kotlin.Array<java.lang.reflect.Type> origin=IMPLICIT_CAST typeOperand=kotlin.Array<java.lang.reflect.Type>
TYPE_OP type=kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>
CALL 'public open fun getGenericInterfaces (): @[FlexibleNullability] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>? declared in java.lang.Class' type=@[FlexibleNullability] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>? origin=null
$this: TYPE_OP type=java.lang.Class<*> origin=IMPLICIT_NOTNULL typeOperand=java.lang.Class<*>
CALL 'public open fun forName (p0: @[FlexibleNullability] kotlin.String?): @[FlexibleNullability] java.lang.Class<*>? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.Class<*>? origin=null
p0: CONST String type=kotlin.String value="TypeParameterInDelegatedPropertyKt$property$2"
WHEN type=kotlin.Unit origin=IF
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCL
$this: CALL 'public final fun contains (other: kotlin.CharSequence, ignoreCase: kotlin.Boolean): kotlin.Boolean declared in kotlin.text' type=kotlin.Boolean origin=null
$receiver: CALL 'public open fun toString (): kotlin.String declared in java.lang.reflect.Type' type=kotlin.String origin=null
$this: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=java.lang.reflect.Type origin=GET_ARRAY_ELEMENT
$this: GET_VAR 'val superInterfaces: kotlin.Array<java.lang.reflect.Type> declared in <root>.box' type=kotlin.Array<java.lang.reflect.Type> origin=null
index: CONST Int type=kotlin.Int value=0
other: CONST String type=kotlin.String value="IDelegate<java.lang.Object>"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="FAIL"
VAR name:superInterfaces2 type:kotlin.Array<java.lang.reflect.Type> [val]
TYPE_OP type=kotlin.Array<java.lang.reflect.Type> origin=IMPLICIT_CAST typeOperand=kotlin.Array<java.lang.reflect.Type>
TYPE_OP type=kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>
CALL 'public open fun getGenericInterfaces (): @[FlexibleNullability] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>? declared in java.lang.Class' type=@[FlexibleNullability] kotlin.Array<out @[FlexibleNullability] java.lang.reflect.Type?>? origin=null
$this: TYPE_OP type=java.lang.Class<*> origin=IMPLICIT_NOTNULL typeOperand=java.lang.Class<*>
CALL 'public open fun forName (p0: @[FlexibleNullability] kotlin.String?): @[FlexibleNullability] java.lang.Class<*>? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.Class<*>? origin=null
p0: CONST String type=kotlin.String value="TypeParameterInDelegatedPropertyKt$property2$2$1"
WHEN type=kotlin.Unit origin=IF
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCL
$this: CALL 'public final fun contains (other: kotlin.CharSequence, ignoreCase: kotlin.Boolean): kotlin.Boolean declared in kotlin.text' type=kotlin.Boolean origin=null
$receiver: CALL 'public open fun toString (): kotlin.String declared in java.lang.reflect.Type' type=kotlin.String origin=null
$this: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=java.lang.reflect.Type origin=GET_ARRAY_ELEMENT
$this: GET_VAR 'val superInterfaces2: kotlin.Array<java.lang.reflect.Type> declared in <root>.box' type=kotlin.Array<java.lang.reflect.Type> origin=null
index: CONST Int type=kotlin.Int value=0
other: CONST String type=kotlin.String value="IDelegate<java.lang.Object>"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="FAIL"
WHEN type=kotlin.Unit origin=IF
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'public final fun <get-property2> <T> (): T of <root>.<get-property2> declared in <root>' type=kotlin.String origin=GET_PROPERTY
<T>: kotlin.String
$receiver: CONST String type=kotlin.String value="OK"
arg1: CONST String type=kotlin.String value="OK"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="FAIL"
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="OK"
@@ -0,0 +1,41 @@
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// DUMP_IR
// ISSUE: KT-62884
import kotlin.reflect.KProperty
import java.lang.reflect.Type
interface IDelegate<T> {
operator fun getValue(t: T, p: KProperty<*>): T
}
val <T> T.property by object : IDelegate<T> {
override fun getValue(t: T, p: KProperty<*>): T {
return t
}
}
val <T> T.property2 by run<IDelegate<T>> {
fun test(t: T): T {
return t
}
object : IDelegate<T> {
override fun getValue(t: T, p: KProperty<*>): T {
return test(t)
}
}
}
fun box(): String {
val superInterfaces: Array<Type> = Class.forName("TypeParameterInDelegatedPropertyKt\$property\$2").getGenericInterfaces()
if (!superInterfaces[0].toString().contains("IDelegate<java.lang.Object>")) return "FAIL"
val superInterfaces2: Array<Type> = Class.forName("TypeParameterInDelegatedPropertyKt\$property2\$2\$1").getGenericInterfaces()
if (!superInterfaces2[0].toString().contains("IDelegate<java.lang.Object>")) return "FAIL"
if ("OK".property2 != "OK") return "FAIL"
return "OK"
}
@@ -1,43 +0,0 @@
MODULE lib
CLASS LibKt$additionalText$2.class
Property: class.signature
K1
Ljava/lang/Object;LIDelegate1<LValue<Ljava/lang/Object;LCR<Ljava/lang/Object;>;>;LP<Ljava/lang/Object;Ljava/lang/Object;>;>;
K2
Ljava/lang/Object;LIDelegate1<LValue<TT;LCR<TT;>;>;LP<TT;TT;>;>;
METHOD getValue(LValue;Lkotlin/reflect/KProperty;)LP;
Property: method.signature
K1
(LValue<Ljava/lang/Object;LCR<Ljava/lang/Object;>;>;Lkotlin/reflect/KProperty<*>;)LP<Ljava/lang/Object;Ljava/lang/Object;>;
K2
(LValue<TT;LCR<TT;>;>;Lkotlin/reflect/KProperty<*>;)LP<TT;TT;>;
CLASS LibKt$additionalText$2$deepO$2.class
Property: class.signature
K1
Ljava/lang/Object;LIDelegate1<LValue<Ljava/lang/Object;LCR<Ljava/lang/Object;>;>;Ljava/lang/Object;>;
K2
Ljava/lang/Object;LIDelegate1<LValue<TT;LCR<TT;>;>;TT;>;
METHOD getValue(LValue;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
Property: method.signature
K1
(LValue<Ljava/lang/Object;LCR<Ljava/lang/Object;>;>;Lkotlin/reflect/KProperty<*>;)Ljava/lang/Object;
K2
(LValue<TT;LCR<TT;>;>;Lkotlin/reflect/KProperty<*>;)TT;
CLASS LibKt$additionalText$2$deepK$2.class
Property: class.signature
K1
Ljava/lang/Object;LIDelegate1<LValue<Ljava/lang/Object;LCR<Ljava/lang/Object;>;>;Ljava/lang/Object;>;
K2
Ljava/lang/Object;LIDelegate1<LValue<TT;LCR<TT;>;>;TT;>;
METHOD getValue(LValue;Lkotlin/reflect/KProperty;)Ljava/lang/Object;
Property: method.signature
K1
(LValue<Ljava/lang/Object;LCR<Ljava/lang/Object;>;>;Lkotlin/reflect/KProperty<*>;)Ljava/lang/Object;
K2
(LValue<TT;LCR<TT;>;>;Lkotlin/reflect/KProperty<*>;)TT;
METHOD qux22(LIR;)Ljava/lang/Object;
Property: method.signature
K1
<F22T::LIR<Ljava/lang/Object;>;>(TF22T;)Ljava/lang/Object;
K2
<F22T::LIR<TT;>;>(TF22T;)TT;
@@ -2,7 +2,6 @@
// SKIP_MANGLE_VERIFICATION
//For KT-6020
// KT-24643: language version in K2 is >= 1.8
// JVM_ABI_K1_K2_DIFF: KT-62884
// MODULE: lib
// FILE: lib.kt