[FIR] Provide object [dispatch] && callable reference receivers properly

This commit is contained in:
Mikhail Glukhikh
2020-04-08 16:09:21 +03:00
parent 00fedbf6b3
commit a93c7a39e0
18 changed files with 62 additions and 152 deletions
@@ -63,8 +63,6 @@ FILE fqName:<root> fileName:/memberExtension.kt
$receiver: CONST String type=kotlin.String value="K"
host: GET_VAR '<this>: <root>.Host declared in <root>.Host' type=<root>.Host origin=null
p: PROPERTY_REFERENCE 'public final plusK: kotlin.String [delegated,val]' field=null getter='public final fun <get-plusK> (): kotlin.String declared in <root>.Host' setter=null type=kotlin.reflect.KProperty2<kotlin.String, <root>.Host, kotlin.String> origin=PROPERTY_REFERENCE_FOR_DELEGATE
$this: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
$receiver: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-plusK> visibility:public modality:FINAL <> ($this:<root>.Host, $receiver:kotlin.String) returnType:kotlin.String
correspondingProperty: PROPERTY name:plusK visibility:public modality:FINAL [delegated,val]
$this: VALUE_PARAMETER name:<this> type:<root>.Host
@@ -76,8 +74,6 @@ FILE fqName:<root> fileName:/memberExtension.kt
receiver: GET_VAR '<this>: <root>.Host declared in <root>.Host.<get-plusK>' type=<root>.Host origin=null
receiver: GET_VAR '<this>: <root>.Host declared in <root>.Host.<get-plusK>' type=<root>.Host origin=null
p: PROPERTY_REFERENCE 'public final plusK: kotlin.String [delegated,val]' field=null getter='public final fun <get-plusK> (): kotlin.String declared in <root>.Host' setter=null type=kotlin.reflect.KProperty2<kotlin.String, <root>.Host, kotlin.String> origin=PROPERTY_REFERENCE_FOR_DELEGATE
$this: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
$receiver: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
PROPERTY name:ok visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:ok type:kotlin.String visibility:private [final]
EXPRESSION_BODY
@@ -22,6 +22,7 @@ FILE fqName:<root> fileName:/withArgumentAdaptationAndReceiver.kt
BLOCK_BODY
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/use]>#' type=IrErrorType
FUNCTION_REFERENCE 'public final fun withVararg (vararg xs: kotlin.Int): kotlin.String declared in <root>.Host' type=kotlin.reflect.KFunction1<kotlin.IntArray, kotlin.String> origin=null reflectionTarget=<same>
$this: GET_VAR '<this>: <root>.Host declared in <root>.Host.testImplicitThis' type=<root>.Host origin=null
FUN name:testBoundReceiverLocalVal visibility:public modality:FINAL <> ($this:<root>.Host) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Host
BLOCK_BODY
@@ -1,92 +0,0 @@
FILE fqName:<root> fileName:/membersImportedFromObject.kt
CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
CONSTRUCTOR visibility:private <> () returnType:<root>.A [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
FUN name:foo visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
$this: VALUE_PARAMETER name:<this> type:<root>.A
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Int declared in <root>.A'
CONST Int type=kotlin.Int value=1
FUN name:fooExt visibility:public modality:FINAL <> ($this:<root>.A, $receiver:kotlin.Int) returnType:kotlin.Int
$this: VALUE_PARAMETER name:<this> type:<root>.A
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fooExt (): kotlin.Int declared in <root>.A'
CONST Int type=kotlin.Int value=2
PROPERTY name:bar visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:bar type:kotlin.Int visibility:private [final]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=42
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-bar> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Int
correspondingProperty: PROPERTY name:bar visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.A
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-bar> (): kotlin.Int declared in <root>.A'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:bar type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.A declared in <root>.A.<get-bar>' type=<root>.A origin=null
PROPERTY name:barExt visibility:public modality:FINAL [val]
FUN name:<get-barExt> visibility:public modality:FINAL <> ($this:<root>.A, $receiver:kotlin.Int) returnType:kotlin.Int
correspondingProperty: PROPERTY name:barExt visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.A
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-barExt> (): kotlin.Int declared in <root>.A'
CONST Int type=kotlin.Int value=43
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:test1 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Int visibility:private [final,static]
EXPRESSION_BODY
CALL 'public final fun foo (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=null
$this: GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test1> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null
PROPERTY name:test2 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Int visibility:private [final,static]
EXPRESSION_BODY
CALL 'public final fun <get-bar> (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
$this: GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test2> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null
PROPERTY name:test3 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.Int visibility:private [final,static]
EXPRESSION_BODY
CALL 'public final fun fooExt (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=null
$this: CONST Int type=kotlin.Int value=1
$receiver: CONST Int type=kotlin.Int value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test3> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test3> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null
PROPERTY name:test4 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Int visibility:private [final,static]
EXPRESSION_BODY
CALL 'public final fun <get-barExt> (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
$this: CONST Int type=kotlin.Int value=1
$receiver: CONST Int type=kotlin.Int value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test4> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test4> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
import A.foo
import A.bar
import A.fooExt
@@ -180,7 +180,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
if: CALL 'public final fun not (): kotlin.Boolean [operator] 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 f (): kotlin.Int declared in <root>.C' type=kotlin.Int origin=null
$this: CONST Boolean type=kotlin.Boolean value=true
$this: GET_OBJECT 'CLASS OBJECT name:C modality:FINAL visibility:public superTypes:[<root>.BaseClass; <root>.I<kotlin.String>]' type=<root>.C
$receiver: CONST Boolean type=kotlin.Boolean value=true
arg1: CONST Int type=kotlin.Int value=3
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
@@ -211,7 +211,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
if: CALL 'public final fun not (): kotlin.Boolean [operator] 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-ext> (): kotlin.Int declared in <root>.C' type=kotlin.Int origin=GET_PROPERTY
$this: CONST Int type=kotlin.Int value=5
$this: GET_OBJECT 'CLASS OBJECT name:C modality:FINAL visibility:public superTypes:[<root>.BaseClass; <root>.I<kotlin.String>]' type=<root>.C
$receiver: CONST Int type=kotlin.Int value=5
arg1: CONST Int type=kotlin.Int value=6
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
@@ -233,7 +233,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
$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-g2> <T> (): T of <root>.C.<get-g2> declared in <root>.C' type=kotlin.String origin=GET_PROPERTY
<T>: kotlin.String
$this: CONST String type=kotlin.String value="8"
$this: GET_OBJECT 'CLASS OBJECT name:C modality:FINAL visibility:public superTypes:[<root>.BaseClass; <root>.I<kotlin.String>]' type=<root>.C
$receiver: CONST String type=kotlin.String value="8"
arg1: CONST String type=kotlin.String value="8"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
@@ -244,7 +244,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
$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 open fun fromInterface <T> (): T of <root>.C.fromInterface [fake_override] declared in <root>.C' type=kotlin.Int origin=null
<T>: kotlin.Int
$this: CONST Int type=kotlin.Int value=9
$this: GET_OBJECT 'CLASS OBJECT name:C modality:FINAL visibility:public superTypes:[<root>.BaseClass; <root>.I<kotlin.String>]' type=<root>.C
$receiver: CONST Int type=kotlin.Int value=9
arg1: CONST Int type=kotlin.Int value=9
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'