KT-42151 fix type arguments in local class constructor reference types

This commit is contained in:
Dmitry Petrov
2020-11-26 15:05:41 +03:00
parent b2b8562f92
commit ee1e05fedd
22 changed files with 678 additions and 32 deletions
@@ -1,7 +1,6 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
// KT-42025
@@ -0,0 +1,25 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// IGNORE_BACKEND_FIR: JVM_IR
// KT-42025
open class L<LL>(val ll: LL)
class Rec<T>(val rt: T)
fun <FT> Rec<FT>.fn(): L<FT> {
class FLocal<LT>(lt: LT, val pt: FT): L<LT>(lt)
return foo2(rt, rt, ::FLocal)
}
val <PT> Rec<PT>.p: L<PT>
get() {
class PLocal<LT>(lt: LT, val pt: PT): L<LT>(lt)
return foo2(rt, rt, ::PLocal)
}
fun <T1, T2, R> foo2(t1: T1, t2: T2, bb: (T1, T2) -> R): R = bb(t1, t2)
fun box(): String =
Rec("O").fn().ll + Rec("K").p.ll
@@ -0,0 +1,64 @@
open class L<LL : Any?> {
constructor(ll: LL) /* primary */ {
super/*Any*/()
/* <init>() */
}
val ll: LL
field = ll
get
}
class Rec<T : Any?> {
constructor(rt: T) /* primary */ {
super/*Any*/()
/* <init>() */
}
val rt: T
field = rt
get
}
val <PT : Any?> Rec<PT>.p: L<PT>
get(): L<PT> {
local class PLocal<LT : Any?> : L<LT> {
constructor(lt: LT, pt: PT) /* primary */ {
super/*L*/<LT>(ll = lt)
/* <init>() */
}
val pt: PT
field = pt
get
}
return foo2<PT, PT, PLocal<PT>>(t1 = <this>.<get-rt>(), t2 = <this>.<get-rt>(), bb = PLocal::<init>/*<PT>()*/)
}
fun <FT : Any?> Rec<FT>.fn(): L<FT> {
local class FLocal<LT : Any?> : L<LT> {
constructor(lt: LT, pt: FT) /* primary */ {
super/*L*/<LT>(ll = lt)
/* <init>() */
}
val pt: FT
field = pt
get
}
return foo2<FT, FT, FLocal<FT>>(t1 = <this>.<get-rt>(), t2 = <this>.<get-rt>(), bb = FLocal::<init>/*<FT>()*/)
}
fun <T1 : Any?, T2 : Any?, R : Any?> foo2(t1: T1, t2: T2, bb: Function2<T1, T2, R>): R {
return bb.invoke(p1 = t1, p2 = t2)
}
@@ -0,0 +1,192 @@
FILE fqName:<root> fileName:/genericLocalClassConstructorReference.kt
CLASS CLASS name:L modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.L<LL of <root>.L>
TYPE_PARAMETER name:LL index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (ll:LL of <root>.L) returnType:<root>.L<LL of <root>.L> [primary]
VALUE_PARAMETER name:ll index:0 type:LL of <root>.L
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:L modality:OPEN visibility:public superTypes:[kotlin.Any]'
PROPERTY name:ll visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:ll type:LL of <root>.L visibility:private [final]
EXPRESSION_BODY
GET_VAR 'll: LL of <root>.L declared in <root>.L.<init>' type=LL of <root>.L origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-ll> visibility:public modality:FINAL <> ($this:<root>.L<LL of <root>.L>) returnType:LL of <root>.L
correspondingProperty: PROPERTY name:ll visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.L<LL of <root>.L>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-ll> (): LL of <root>.L declared in <root>.L'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:ll type:LL of <root>.L visibility:private [final]' type=LL of <root>.L origin=null
receiver: GET_VAR '<this>: <root>.L<LL of <root>.L> declared in <root>.L.<get-ll>' type=<root>.L<LL of <root>.L> 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 [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:Rec modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Rec<T of <root>.Rec>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (rt:T of <root>.Rec) returnType:<root>.Rec<T of <root>.Rec> [primary]
VALUE_PARAMETER name:rt index:0 type:T of <root>.Rec
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Rec modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:rt visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:rt type:T of <root>.Rec visibility:private [final]
EXPRESSION_BODY
GET_VAR 'rt: T of <root>.Rec declared in <root>.Rec.<init>' type=T of <root>.Rec origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-rt> visibility:public modality:FINAL <> ($this:<root>.Rec<T of <root>.Rec>) returnType:T of <root>.Rec
correspondingProperty: PROPERTY name:rt visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Rec<T of <root>.Rec>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:rt type:T of <root>.Rec visibility:private [final]' type=T of <root>.Rec origin=null
receiver: GET_VAR '<this>: <root>.Rec<T of <root>.Rec> declared in <root>.Rec.<get-rt>' type=<root>.Rec<T of <root>.Rec> 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 [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
PROPERTY name:p visibility:public modality:FINAL [val]
FUN name:<get-p> visibility:public modality:FINAL <PT> ($receiver:<root>.Rec<PT of <root>.<get-p>>) returnType:<root>.L<PT of <root>.<get-p>>
correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val]
TYPE_PARAMETER name:PT index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:<root>.Rec<PT of <root>.<get-p>>
BLOCK_BODY
CLASS CLASS name:PLocal modality:FINAL visibility:local superTypes:[<root>.L<LT of <root>.<get-p>.PLocal>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal>
TYPE_PARAMETER name:LT index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (lt:LT of <root>.<get-p>.PLocal, pt:PT of <root>.<get-p>) returnType:<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal> [primary]
VALUE_PARAMETER name:lt index:0 type:LT of <root>.<get-p>.PLocal
VALUE_PARAMETER name:pt index:1 type:PT of <root>.<get-p>
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (ll: LL of <root>.L) [primary] declared in <root>.L'
<LL>: LT of <root>.<get-p>.PLocal
ll: GET_VAR 'lt: LT of <root>.<get-p>.PLocal declared in <root>.<get-p>.PLocal.<init>' type=LT of <root>.<get-p>.PLocal origin=null
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PLocal modality:FINAL visibility:local superTypes:[<root>.L<LT of <root>.<get-p>.PLocal>]'
PROPERTY name:pt visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:pt type:PT of <root>.<get-p> visibility:private [final]
EXPRESSION_BODY
GET_VAR 'pt: PT of <root>.<get-p> declared in <root>.<get-p>.PLocal.<init>' type=PT of <root>.<get-p> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-pt> visibility:public modality:FINAL <> ($this:<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal>) returnType:PT of <root>.<get-p>
correspondingProperty: PROPERTY name:pt visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-pt> (): PT of <root>.<get-p> declared in <root>.<get-p>.PLocal'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:pt type:PT of <root>.<get-p> visibility:private [final]' type=PT of <root>.<get-p> origin=null
receiver: GET_VAR '<this>: <root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal> declared in <root>.<get-p>.PLocal.<get-pt>' type=<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal> origin=null
PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val]
FUN FAKE_OVERRIDE name:<get-ll> visibility:public modality:FINAL <> ($this:<root>.L<LL of <root>.L>) returnType:LT of <root>.<get-p>.PLocal [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val]
overridden:
public final fun <get-ll> (): LL of <root>.L declared in <root>.L
$this: VALUE_PARAMETER name:<this> type:<root>.L<LL of <root>.L>
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
RETURN type=kotlin.Nothing from='public final fun <get-p> <PT> (): <root>.L<PT of <root>.<get-p>> declared in <root>'
CALL 'public final fun foo2 <T1, T2, R> (t1: T1 of <root>.foo2, t2: T2 of <root>.foo2, bb: kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>): R of <root>.foo2 declared in <root>' type=<root>.<get-p>.PLocal<PT of <root>.<get-p>> origin=null
<T1>: PT of <root>.<get-p>
<T2>: PT of <root>.<get-p>
<R>: <root>.<get-p>.PLocal<PT of <root>.<get-p>>
t1: CALL 'public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec' type=PT of <root>.<get-p> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Rec<PT of <root>.<get-p>> declared in <root>.<get-p>' type=<root>.Rec<PT of <root>.<get-p>> origin=null
t2: CALL 'public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec' type=PT of <root>.<get-p> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Rec<PT of <root>.<get-p>> declared in <root>.<get-p>' type=<root>.Rec<PT of <root>.<get-p>> origin=null
bb: FUNCTION_REFERENCE 'public constructor <init> (lt: LT of <root>.<get-p>.PLocal, pt: PT of <root>.<get-p>) [primary] declared in <root>.<get-p>.PLocal' type=kotlin.reflect.KFunction2<PT of <root>.<get-p>, PT of <root>.<get-p>, <root>.<get-p>.PLocal<PT of <root>.<get-p>>> origin=null reflectionTarget=<same>
<LT>: PT of <root>.<get-p>
FUN name:fn visibility:public modality:FINAL <FT> ($receiver:<root>.Rec<FT of <root>.fn>) returnType:<root>.L<FT of <root>.fn>
TYPE_PARAMETER name:FT index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:<root>.Rec<FT of <root>.fn>
BLOCK_BODY
CLASS CLASS name:FLocal modality:FINAL visibility:local superTypes:[<root>.L<LT of <root>.fn.FLocal>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.fn.FLocal<LT of <root>.fn.FLocal>
TYPE_PARAMETER name:LT index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (lt:LT of <root>.fn.FLocal, pt:FT of <root>.fn) returnType:<root>.fn.FLocal<LT of <root>.fn.FLocal> [primary]
VALUE_PARAMETER name:lt index:0 type:LT of <root>.fn.FLocal
VALUE_PARAMETER name:pt index:1 type:FT of <root>.fn
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (ll: LL of <root>.L) [primary] declared in <root>.L'
<LL>: LT of <root>.fn.FLocal
ll: GET_VAR 'lt: LT of <root>.fn.FLocal declared in <root>.fn.FLocal.<init>' type=LT of <root>.fn.FLocal origin=null
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FLocal modality:FINAL visibility:local superTypes:[<root>.L<LT of <root>.fn.FLocal>]'
PROPERTY name:pt visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:pt type:FT of <root>.fn visibility:private [final]
EXPRESSION_BODY
GET_VAR 'pt: FT of <root>.fn declared in <root>.fn.FLocal.<init>' type=FT of <root>.fn origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-pt> visibility:public modality:FINAL <> ($this:<root>.fn.FLocal<LT of <root>.fn.FLocal>) returnType:FT of <root>.fn
correspondingProperty: PROPERTY name:pt visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.fn.FLocal<LT of <root>.fn.FLocal>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-pt> (): FT of <root>.fn declared in <root>.fn.FLocal'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:pt type:FT of <root>.fn visibility:private [final]' type=FT of <root>.fn origin=null
receiver: GET_VAR '<this>: <root>.fn.FLocal<LT of <root>.fn.FLocal> declared in <root>.fn.FLocal.<get-pt>' type=<root>.fn.FLocal<LT of <root>.fn.FLocal> origin=null
PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val]
FUN FAKE_OVERRIDE name:<get-ll> visibility:public modality:FINAL <> ($this:<root>.L<LL of <root>.L>) returnType:LT of <root>.fn.FLocal [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val]
overridden:
public final fun <get-ll> (): LL of <root>.L declared in <root>.L
$this: VALUE_PARAMETER name:<this> type:<root>.L<LL of <root>.L>
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
RETURN type=kotlin.Nothing from='public final fun fn <FT> (): <root>.L<FT of <root>.fn> declared in <root>'
CALL 'public final fun foo2 <T1, T2, R> (t1: T1 of <root>.foo2, t2: T2 of <root>.foo2, bb: kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>): R of <root>.foo2 declared in <root>' type=<root>.fn.FLocal<FT of <root>.fn> origin=null
<T1>: FT of <root>.fn
<T2>: FT of <root>.fn
<R>: <root>.fn.FLocal<FT of <root>.fn>
t1: CALL 'public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec' type=FT of <root>.fn origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Rec<FT of <root>.fn> declared in <root>.fn' type=<root>.Rec<FT of <root>.fn> origin=null
t2: CALL 'public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec' type=FT of <root>.fn origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Rec<FT of <root>.fn> declared in <root>.fn' type=<root>.Rec<FT of <root>.fn> origin=null
bb: FUNCTION_REFERENCE 'public constructor <init> (lt: LT of <root>.fn.FLocal, pt: FT of <root>.fn) [primary] declared in <root>.fn.FLocal' type=kotlin.reflect.KFunction2<FT of <root>.fn, FT of <root>.fn, <root>.fn.FLocal<FT of <root>.fn>> origin=null reflectionTarget=<same>
<LT>: FT of <root>.fn
FUN name:foo2 visibility:public modality:FINAL <T1, T2, R> (t1:T1 of <root>.foo2, t2:T2 of <root>.foo2, bb:kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>) returnType:R of <root>.foo2
TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Any?]
TYPE_PARAMETER name:T2 index:1 variance: superTypes:[kotlin.Any?]
TYPE_PARAMETER name:R index:2 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:t1 index:0 type:T1 of <root>.foo2
VALUE_PARAMETER name:t2 index:1 type:T2 of <root>.foo2
VALUE_PARAMETER name:bb index:2 type:kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo2 <T1, T2, R> (t1: T1 of <root>.foo2, t2: T2 of <root>.foo2, bb: kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>): R of <root>.foo2 declared in <root>'
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function2, p2: P2 of kotlin.Function2): R of kotlin.Function2 [operator] declared in kotlin.Function2' type=R of <root>.foo2 origin=INVOKE
$this: GET_VAR 'bb: kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2> declared in <root>.foo2' type=kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2> origin=VARIABLE_AS_FUNCTION
p1: GET_VAR 't1: T1 of <root>.foo2 declared in <root>.foo2' type=T1 of <root>.foo2 origin=null
p2: GET_VAR 't2: T2 of <root>.foo2 declared in <root>.foo2' type=T2 of <root>.foo2 origin=null
@@ -0,0 +1,16 @@
open class L<LL>(val ll: LL)
class Rec<T>(val rt: T)
val <PT> Rec<PT>.p: L<PT>
get() {
class PLocal<LT>(lt: LT, val pt: PT): L<LT>(lt)
return foo2(rt, rt, ::PLocal)
}
fun <FT> Rec<FT>.fn(): L<FT> {
class FLocal<LT>(lt: LT, val pt: FT) : L<LT>(lt)
return foo2(rt, rt, ::FLocal)
}
fun <T1, T2, R> foo2(t1: T1, t2: T2, bb: (T1, T2) -> R): R = bb(t1, t2)
@@ -0,0 +1,64 @@
open class L<LL : Any?> {
constructor(ll: LL) /* primary */ {
super/*Any*/()
/* <init>() */
}
val ll: LL
field = ll
get
}
class Rec<T : Any?> {
constructor(rt: T) /* primary */ {
super/*Any*/()
/* <init>() */
}
val rt: T
field = rt
get
}
val <PT : Any?> Rec<PT>.p: L<PT>
get(): L<PT> {
local class PLocal<LT : Any?> : L<LT> {
constructor(lt: LT, pt: PT) /* primary */ {
super/*L*/<LT>(ll = lt)
/* <init>() */
}
val pt: PT
field = pt
get
}
return foo2<PT, PT, PLocal<PT>>(t1 = <this>.<get-rt>(), t2 = <this>.<get-rt>(), bb = PLocal::<init>/*<PT>()*/)
}
fun <FT : Any?> Rec<FT>.fn(): L<FT> {
local class FLocal<LT : Any?> : L<LT> {
constructor(lt: LT, pt: FT) /* primary */ {
super/*L*/<LT>(ll = lt)
/* <init>() */
}
val pt: FT
field = pt
get
}
return foo2<FT, FT, FLocal<FT, FT>>(t1 = <this>.<get-rt>(), t2 = <this>.<get-rt>(), bb = FLocal::<init>/*<FT>()*/)
}
fun <T1 : Any?, T2 : Any?, R : Any?> foo2(t1: T1, t2: T2, bb: Function2<T1, T2, R>): R {
return bb.invoke(p1 = t1, p2 = t2)
}
@@ -0,0 +1,192 @@
FILE fqName:<root> fileName:/genericLocalClassConstructorReference.kt
CLASS CLASS name:L modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.L<LL of <root>.L>
TYPE_PARAMETER name:LL index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (ll:LL of <root>.L) returnType:<root>.L<LL of <root>.L> [primary]
VALUE_PARAMETER name:ll index:0 type:LL of <root>.L
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:L modality:OPEN visibility:public superTypes:[kotlin.Any]'
PROPERTY name:ll visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:ll type:LL of <root>.L visibility:private [final]
EXPRESSION_BODY
GET_VAR 'll: LL of <root>.L declared in <root>.L.<init>' type=LL of <root>.L origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-ll> visibility:public modality:FINAL <> ($this:<root>.L<LL of <root>.L>) returnType:LL of <root>.L
correspondingProperty: PROPERTY name:ll visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.L<LL of <root>.L>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-ll> (): LL of <root>.L declared in <root>.L'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:ll type:LL of <root>.L visibility:private [final]' type=LL of <root>.L origin=null
receiver: GET_VAR '<this>: <root>.L<LL of <root>.L> declared in <root>.L.<get-ll>' type=<root>.L<LL of <root>.L> 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 [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:Rec modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Rec<T of <root>.Rec>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (rt:T of <root>.Rec) returnType:<root>.Rec<T of <root>.Rec> [primary]
VALUE_PARAMETER name:rt index:0 type:T of <root>.Rec
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Rec modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:rt visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:rt type:T of <root>.Rec visibility:private [final]
EXPRESSION_BODY
GET_VAR 'rt: T of <root>.Rec declared in <root>.Rec.<init>' type=T of <root>.Rec origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-rt> visibility:public modality:FINAL <> ($this:<root>.Rec<T of <root>.Rec>) returnType:T of <root>.Rec
correspondingProperty: PROPERTY name:rt visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Rec<T of <root>.Rec>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:rt type:T of <root>.Rec visibility:private [final]' type=T of <root>.Rec origin=null
receiver: GET_VAR '<this>: <root>.Rec<T of <root>.Rec> declared in <root>.Rec.<get-rt>' type=<root>.Rec<T of <root>.Rec> 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 [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
PROPERTY name:p visibility:public modality:FINAL [val]
FUN name:<get-p> visibility:public modality:FINAL <PT> ($receiver:<root>.Rec<PT of <root>.<get-p>>) returnType:<root>.L<PT of <root>.<get-p>>
correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [val]
TYPE_PARAMETER name:PT index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:<root>.Rec<PT of <root>.<get-p>>
BLOCK_BODY
CLASS CLASS name:PLocal modality:FINAL visibility:local superTypes:[<root>.L<LT of <root>.<get-p>.PLocal>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal>
TYPE_PARAMETER name:LT index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (lt:LT of <root>.<get-p>.PLocal, pt:PT of <root>.<get-p>) returnType:<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal> [primary]
VALUE_PARAMETER name:lt index:0 type:LT of <root>.<get-p>.PLocal
VALUE_PARAMETER name:pt index:1 type:PT of <root>.<get-p>
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (ll: LL of <root>.L) [primary] declared in <root>.L'
<LL>: LT of <root>.<get-p>.PLocal
ll: GET_VAR 'lt: LT of <root>.<get-p>.PLocal declared in <root>.<get-p>.PLocal.<init>' type=LT of <root>.<get-p>.PLocal origin=null
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PLocal modality:FINAL visibility:local superTypes:[<root>.L<LT of <root>.<get-p>.PLocal>]'
PROPERTY name:pt visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:pt type:PT of <root>.<get-p> visibility:private [final]
EXPRESSION_BODY
GET_VAR 'pt: PT of <root>.<get-p> declared in <root>.<get-p>.PLocal.<init>' type=PT of <root>.<get-p> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-pt> visibility:public modality:FINAL <> ($this:<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal>) returnType:PT of <root>.<get-p>
correspondingProperty: PROPERTY name:pt visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-pt> (): PT of <root>.<get-p> declared in <root>.<get-p>.PLocal'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:pt type:PT of <root>.<get-p> visibility:private [final]' type=PT of <root>.<get-p> origin=null
receiver: GET_VAR '<this>: <root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal> declared in <root>.<get-p>.PLocal.<get-pt>' type=<root>.<get-p>.PLocal<LT of <root>.<get-p>.PLocal> origin=null
PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val]
FUN FAKE_OVERRIDE name:<get-ll> visibility:public modality:FINAL <> ($this:<root>.L<LT of <root>.<get-p>.PLocal>) returnType:LT of <root>.<get-p>.PLocal [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val]
overridden:
public final fun <get-ll> (): LL of <root>.L declared in <root>.L
$this: VALUE_PARAMETER name:<this> type:<root>.L<LT of <root>.<get-p>.PLocal>
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>.L
$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>.L
$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>.L
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
RETURN type=kotlin.Nothing from='public final fun <get-p> <PT> (): <root>.L<PT of <root>.<get-p>> declared in <root>'
CALL 'public final fun foo2 <T1, T2, R> (t1: T1 of <root>.foo2, t2: T2 of <root>.foo2, bb: kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>): R of <root>.foo2 declared in <root>' type=<root>.<get-p>.PLocal<PT of <root>.<get-p>> origin=null
<T1>: PT of <root>.<get-p>
<T2>: PT of <root>.<get-p>
<R>: <root>.<get-p>.PLocal<PT of <root>.<get-p>>
t1: CALL 'public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec' type=PT of <root>.<get-p> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Rec<PT of <root>.<get-p>> declared in <root>.<get-p>' type=<root>.Rec<PT of <root>.<get-p>> origin=null
t2: CALL 'public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec' type=PT of <root>.<get-p> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Rec<PT of <root>.<get-p>> declared in <root>.<get-p>' type=<root>.Rec<PT of <root>.<get-p>> origin=null
bb: FUNCTION_REFERENCE 'public constructor <init> (lt: LT of <root>.<get-p>.PLocal, pt: PT of <root>.<get-p>) [primary] declared in <root>.<get-p>.PLocal' type=kotlin.reflect.KFunction2<PT of <root>.<get-p>, PT of <root>.<get-p>, <root>.<get-p>.PLocal<PT of <root>.<get-p>>> origin=null reflectionTarget=<same>
<LT>: PT of <root>.<get-p>
FUN name:fn visibility:public modality:FINAL <FT> ($receiver:<root>.Rec<FT of <root>.fn>) returnType:<root>.L<FT of <root>.fn>
TYPE_PARAMETER name:FT index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:<root>.Rec<FT of <root>.fn>
BLOCK_BODY
CLASS CLASS name:FLocal modality:FINAL visibility:local superTypes:[<root>.L<LT of <root>.fn.FLocal>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.fn.FLocal<LT of <root>.fn.FLocal, FT of <root>.fn>
TYPE_PARAMETER name:LT index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (lt:LT of <root>.fn.FLocal, pt:FT of <root>.fn) returnType:<root>.fn.FLocal<LT of <root>.fn.FLocal, FT of <root>.fn> [primary]
VALUE_PARAMETER name:lt index:0 type:LT of <root>.fn.FLocal
VALUE_PARAMETER name:pt index:1 type:FT of <root>.fn
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (ll: LL of <root>.L) [primary] declared in <root>.L'
<LL>: LT of <root>.fn.FLocal
ll: GET_VAR 'lt: LT of <root>.fn.FLocal declared in <root>.fn.FLocal.<init>' type=LT of <root>.fn.FLocal origin=null
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FLocal modality:FINAL visibility:local superTypes:[<root>.L<LT of <root>.fn.FLocal>]'
PROPERTY name:pt visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:pt type:FT of <root>.fn visibility:private [final]
EXPRESSION_BODY
GET_VAR 'pt: FT of <root>.fn declared in <root>.fn.FLocal.<init>' type=FT of <root>.fn origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-pt> visibility:public modality:FINAL <> ($this:<root>.fn.FLocal<LT of <root>.fn.FLocal, FT of <root>.fn>) returnType:FT of <root>.fn
correspondingProperty: PROPERTY name:pt visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.fn.FLocal<LT of <root>.fn.FLocal, FT of <root>.fn>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-pt> (): FT of <root>.fn declared in <root>.fn.FLocal'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:pt type:FT of <root>.fn visibility:private [final]' type=FT of <root>.fn origin=null
receiver: GET_VAR '<this>: <root>.fn.FLocal<LT of <root>.fn.FLocal, FT of <root>.fn> declared in <root>.fn.FLocal.<get-pt>' type=<root>.fn.FLocal<LT of <root>.fn.FLocal, FT of <root>.fn> origin=null
PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val]
FUN FAKE_OVERRIDE name:<get-ll> visibility:public modality:FINAL <> ($this:<root>.L<LT of <root>.fn.FLocal>) returnType:LT of <root>.fn.FLocal [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:ll visibility:public modality:FINAL [fake_override,val]
overridden:
public final fun <get-ll> (): LL of <root>.L declared in <root>.L
$this: VALUE_PARAMETER name:<this> type:<root>.L<LT of <root>.fn.FLocal>
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>.L
$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>.L
$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>.L
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
RETURN type=kotlin.Nothing from='public final fun fn <FT> (): <root>.L<FT of <root>.fn> declared in <root>'
CALL 'public final fun foo2 <T1, T2, R> (t1: T1 of <root>.foo2, t2: T2 of <root>.foo2, bb: kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>): R of <root>.foo2 declared in <root>' type=<root>.fn.FLocal<FT of <root>.fn, FT of <root>.fn> origin=null
<T1>: FT of <root>.fn
<T2>: FT of <root>.fn
<R>: <root>.fn.FLocal<FT of <root>.fn, FT of <root>.fn>
t1: CALL 'public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec' type=FT of <root>.fn origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Rec<FT of <root>.fn> declared in <root>.fn' type=<root>.Rec<FT of <root>.fn> origin=null
t2: CALL 'public final fun <get-rt> (): T of <root>.Rec declared in <root>.Rec' type=FT of <root>.fn origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Rec<FT of <root>.fn> declared in <root>.fn' type=<root>.Rec<FT of <root>.fn> origin=null
bb: FUNCTION_REFERENCE 'public constructor <init> (lt: LT of <root>.fn.FLocal, pt: FT of <root>.fn) [primary] declared in <root>.fn.FLocal' type=kotlin.reflect.KFunction2<FT of <root>.fn, FT of <root>.fn, <root>.fn.FLocal<FT of <root>.fn, FT of <root>.fn>> origin=null reflectionTarget=<same>
<LT>: FT of <root>.fn
FUN name:foo2 visibility:public modality:FINAL <T1, T2, R> (t1:T1 of <root>.foo2, t2:T2 of <root>.foo2, bb:kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>) returnType:R of <root>.foo2
TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Any?]
TYPE_PARAMETER name:T2 index:1 variance: superTypes:[kotlin.Any?]
TYPE_PARAMETER name:R index:2 variance: superTypes:[kotlin.Any?]
VALUE_PARAMETER name:t1 index:0 type:T1 of <root>.foo2
VALUE_PARAMETER name:t2 index:1 type:T2 of <root>.foo2
VALUE_PARAMETER name:bb index:2 type:kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo2 <T1, T2, R> (t1: T1 of <root>.foo2, t2: T2 of <root>.foo2, bb: kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2>): R of <root>.foo2 declared in <root>'
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function2, p2: P2 of kotlin.Function2): R of kotlin.Function2 [operator] declared in kotlin.Function2' type=R of <root>.foo2 origin=INVOKE
$this: GET_VAR 'bb: kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2> declared in <root>.foo2' type=kotlin.Function2<T1 of <root>.foo2, T2 of <root>.foo2, R of <root>.foo2> origin=VARIABLE_AS_FUNCTION
p1: GET_VAR 't1: T1 of <root>.foo2 declared in <root>.foo2' type=T1 of <root>.foo2 origin=null
p2: GET_VAR 't2: T2 of <root>.foo2 declared in <root>.foo2' type=T2 of <root>.foo2 origin=null