FIR: fix dispatch receivers for objects

This commit is contained in:
Mikhail Glukhikh
2019-08-28 16:29:29 +03:00
parent 29b406c731
commit 652fd7ee73
19 changed files with 65 additions and 36 deletions
@@ -56,7 +56,7 @@ FILE fqName:<root> fileName:/destructuring1.kt
GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
VAR name:x type:kotlin.Int [val]
CALL 'public final fun component1 (): kotlin.Int declared in <root>.B' type=kotlin.Int origin=null
$this: GET_VAR 'val <destruct>: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
$this: GET_VAR '<this>: <root>.B declared in <root>.B' type=<root>.B origin=null
VAR name:y type:kotlin.Int [val]
CALL 'public final fun component2 (): kotlin.Int declared in <root>.B' type=kotlin.Int origin=null
$this: GET_VAR 'val <destruct>: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
$this: GET_VAR '<this>: <root>.B declared in <root>.B' type=<root>.B origin=null
@@ -62,10 +62,10 @@ FILE fqName:<root> fileName:/destructuringWithUnderscore.kt
GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
VAR name:x type:kotlin.Int [val]
CALL 'public final fun component1 (): kotlin.Int declared in <root>.B' type=kotlin.Int origin=null
$this: GET_VAR 'val <destruct>: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
$this: GET_VAR '<this>: <root>.B declared in <root>.B' type=<root>.B origin=null
VAR name:_ type:kotlin.Int [val]
CALL 'public final fun component2 (): kotlin.Int declared in <root>.B' type=kotlin.Int origin=null
$this: GET_VAR 'val <destruct>: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
$this: GET_VAR '<this>: <root>.B declared in <root>.B' type=<root>.B origin=null
VAR name:z type:kotlin.Int [val]
CALL 'public final fun component3 (): kotlin.Int declared in <root>.B' type=kotlin.Int origin=null
$this: GET_VAR 'val <destruct>: <root>.A [val] declared in <root>.test' type=<root>.A origin=null
$this: GET_VAR '<this>: <root>.B declared in <root>.B' type=<root>.B origin=null
@@ -29,3 +29,4 @@ FILE fqName:test fileName:/funImportedFromObject.kt
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.String declared in test'
CALL 'public final fun foo <T> (): kotlin.String [inline] declared in test.Host' type=kotlin.String origin=null
<T>: <none>
$this: GET_VAR '<this>: test.Host declared in test.Host' type=test.Host origin=null
@@ -51,6 +51,7 @@ FILE fqName:<root> fileName:/membersImportedFromObject.kt
FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Int visibility:public [final,static]
EXPRESSION_BODY
CALL 'public final fun foo (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A' type=<root>.A origin=null
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
@@ -60,6 +61,7 @@ FILE fqName:<root> fileName:/membersImportedFromObject.kt
FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Int visibility:public [final,static]
EXPRESSION_BODY
CALL 'public final fun <get-bar> (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A' type=<root>.A origin=null
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
@@ -69,7 +71,7 @@ FILE fqName:<root> fileName:/membersImportedFromObject.kt
FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.Int visibility:public [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
$this: GET_VAR '<this>: <root>.A declared in <root>.A' type=<root>.A origin=null
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
@@ -79,7 +81,7 @@ FILE fqName:<root> fileName:/membersImportedFromObject.kt
FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Int visibility:public [final,static]
EXPRESSION_BODY
CALL 'public final fun <get-barExt> (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=null
$this: CONST Int type=kotlin.Int value=1
$this: GET_VAR '<this>: <root>.A declared in <root>.A' type=<root>.A origin=null
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
@@ -31,8 +31,10 @@ FILE fqName:<root> fileName:/objectReference.kt
$this: VALUE_PARAMETER name:<this> type:<root>.Z
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
value: CONST Int type=kotlin.Int value=1
CALL 'public final fun foo (): kotlin.Unit declared in <root>.Z' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_OBJECT 'CLASS OBJECT name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Z
value: CONST Int type=kotlin.Int value=1
@@ -47,8 +49,10 @@ FILE fqName:<root> fileName:/objectReference.kt
ANONYMOUS_INITIALIZER isStatic=false
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
value: CONST Int type=kotlin.Int value=1
CALL 'public final fun foo (): kotlin.Unit declared in <root>.Z' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_OBJECT 'CLASS OBJECT name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Z
value: CONST Int type=kotlin.Int value=1
@@ -58,8 +62,10 @@ FILE fqName:<root> fileName:/objectReference.kt
$this: VALUE_PARAMETER name:<this> type:<root>.Z.Nested
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
value: CONST Int type=kotlin.Int value=1
CALL 'public final fun foo (): kotlin.Unit declared in <root>.Z' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_OBJECT 'CLASS OBJECT name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Z
value: CONST Int type=kotlin.Int value=1
@@ -86,8 +92,10 @@ FILE fqName:<root> fileName:/objectReference.kt
$this: VALUE_PARAMETER name:<this> type:<root>.Z
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
value: CONST Int type=kotlin.Int value=1
CALL 'public final fun foo (): kotlin.Unit declared in <root>.Z' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_OBJECT 'CLASS OBJECT name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Z
value: CONST Int type=kotlin.Int value=1
@@ -113,8 +121,10 @@ FILE fqName:<root> fileName:/objectReference.kt
ANONYMOUS_INITIALIZER isStatic=false
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
value: CONST Int type=kotlin.Int value=1
CALL 'public final fun foo (): kotlin.Unit declared in <root>.Z' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_OBJECT 'CLASS OBJECT name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Z
value: CONST Int type=kotlin.Int value=1
@@ -124,8 +134,10 @@ FILE fqName:<root> fileName:/objectReference.kt
$this: VALUE_PARAMETER name:<this> type:<root>.Z.anObject.<no name provided>
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
value: CONST Int type=kotlin.Int value=1
CALL 'public final fun foo (): kotlin.Unit declared in <root>.Z' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_OBJECT 'CLASS OBJECT name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Z
value: CONST Int type=kotlin.Int value=1
@@ -156,8 +168,10 @@ FILE fqName:<root> fileName:/objectReference.kt
$receiver: VALUE_PARAMETER name:<this> type:<root>.Z
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
value: CONST Int type=kotlin.Int value=1
CALL 'public final fun foo (): kotlin.Unit declared in <root>.Z' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.Z declared in <root>.Z' type=<root>.Z origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_OBJECT 'CLASS OBJECT name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Z
value: CONST Int type=kotlin.Int value=1
@@ -22,6 +22,7 @@ FILE fqName:<root> fileName:/objectReferenceInFieldInitializer.kt
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value="1234"
CALL 'private final fun <get-a> (): kotlin.String declared in <root>.A' type=kotlin.String origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A' type=<root>.A origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-b> visibility:private modality:FINAL <> ($this:<root>.A) returnType:kotlin.String
correspondingProperty: PROPERTY name:b visibility:private modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.A
@@ -148,6 +148,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
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 f (s: kotlin.Int): kotlin.Int declared in <root>.C' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
s: CONST Int type=kotlin.Int value=1
arg1: CONST Int type=kotlin.Int value=1
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
@@ -157,6 +158,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
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 f (s: kotlin.String): kotlin.Int declared in <root>.C' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
s: CONST String type=kotlin.String value="s"
arg1: CONST Int type=kotlin.Int value=2
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
@@ -166,7 +168,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
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 f (): kotlin.Int declared in <root>.C' type=kotlin.Int origin=null
$this: CONST Boolean type=kotlin.Boolean value=true
$this: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
arg1: CONST Int type=kotlin.Int value=3
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="3"
@@ -175,16 +177,19 @@ FILE fqName:<root> fileName:/useImportedMember.kt
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-p> (): kotlin.Int declared in <root>.C' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
arg1: CONST Int type=kotlin.Int value=4
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="4"
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
value: CONST Int type=kotlin.Int value=5
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-p> (): kotlin.Int declared in <root>.C' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
arg1: CONST Int type=kotlin.Int value=5
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="5"
@@ -193,7 +198,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
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-ext> (): kotlin.Int declared in <root>.C' type=kotlin.Int origin=null
$this: CONST Int type=kotlin.Int value=5
$this: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
arg1: CONST Int type=kotlin.Int value=6
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="6"
@@ -203,6 +208,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 g1 <T> (t: T of <root>.C.g1): T of <root>.C.g1 declared in <root>.C' type=kotlin.String origin=null
<T>: <none>
$this: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
t: CONST String type=kotlin.String value="7"
arg1: CONST String type=kotlin.String value="7"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
@@ -212,7 +218,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
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-g2> (): T of <uninitialized parent> declared in <root>.C' type=kotlin.String origin=null
$this: CONST String type=kotlin.String value="8"
$this: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
arg1: CONST String type=kotlin.String value="8"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="8"
@@ -229,7 +235,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
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-fromClass> (): T of <uninitialized parent> declared in <root>.BaseClass' type=kotlin.String origin=null
$this: CONST String type=kotlin.String value="10"
$this: GET_VAR '<this>: <root>.BaseClass declared in <root>.BaseClass' type=<root>.BaseClass origin=null
arg1: CONST String type=kotlin.String value="10"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CONST String type=kotlin.String value="10"
@@ -238,6 +244,7 @@ FILE fqName:<root> fileName:/useImportedMember.kt
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 open fun genericFromSuper (g: kotlin.String): kotlin.String declared in <root>.I' type=kotlin.String origin=null
$this: GET_VAR '<this>: <root>.I declared in <root>.I' type=<root>.I<*> origin=null
g: CONST String type=kotlin.String value="11"
arg1: CONST String type=kotlin.String value="11"
then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'