FIR2IR: set 'SetField' type to Unit, convert explicit 'this' references

This commit is contained in:
Mikhail Glukhikh
2019-08-26 19:32:21 +03:00
parent 6604539154
commit da22898a19
53 changed files with 171 additions and 262 deletions
@@ -66,7 +66,7 @@ FILE fqName:<root> fileName:/delegatedPropertyAccessorsWithAnnotations.kt
VALUE_PARAMETER name:kProp index:1 type:kotlin.Any?
VALUE_PARAMETER name:newValue index:2 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Int visibility:public' type=kotlin.Int origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
value: GET_VAR 'newValue: kotlin.Int declared in <root>.Cell.setValue' type=kotlin.Int origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
overridden:
@@ -58,7 +58,7 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
$this: VALUE_PARAMETER name:<this> type:<root>.C
VALUE_PARAMETER name:value index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Int visibility:public' type=kotlin.Int origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
value: GET_VAR 'value: kotlin.Int declared in <root>.C.<set-test4>' type=kotlin.Int origin=null
PROPERTY name:test5 visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:test5 type:kotlin.Int visibility:public
@@ -98,7 +98,7 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
RETURN type=kotlin.Nothing from='public final fun <get-test7> (): kotlin.Int declared in <root>.C'
CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): T of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Int origin=null
$receiver: GET_FIELD 'FIELD DELEGATE name:test7$delegate type:kotlin.Lazy<kotlin.Int> visibility:private [final]' type=kotlin.Lazy<kotlin.Int> origin=GET_PROPERTY
thisRef: ERROR_CALL 'Unresolved reference: this#' type=<root>.C
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
property: PROPERTY_REFERENCE 'public final test7: kotlin.Int [delegated,val]' field='FIELD DELEGATE name:test7$delegate type:kotlin.Lazy<kotlin.Int> visibility:private [final]' getter=null setter=null type=kotlin.reflect.KProperty<*> origin=null
PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
FIELD DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]
@@ -110,7 +110,7 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): IrErrorType declared in <root>.C'
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: this#' type=<root>.C
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field='FIELD DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]' getter=null setter=null type=kotlin.reflect.KProperty<*> origin=null
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test8> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:IrErrorType) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
@@ -118,7 +118,7 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
BLOCK_BODY
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: this#' type=<root>.C
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field='FIELD DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]' getter='public final fun <get-test8> (): IrErrorType declared in <root>.C' setter=null type=kotlin.reflect.KProperty<*> origin=null
GET_VAR '<set-?>: IrErrorType declared in <root>.C.<set-test8>' type=IrErrorType origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
@@ -49,7 +49,7 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
RETURN type=kotlin.Nothing from='public final fun <get-test2> (): kotlin.Int declared in <root>.C'
CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): T of <uninitialized parent> [inline] declared in kotlin' type=kotlin.Int origin=null
$receiver: GET_FIELD 'FIELD DELEGATE name:test2$delegate type:kotlin.Lazy<kotlin.Int> visibility:private [final]' type=kotlin.Lazy<kotlin.Int> origin=GET_PROPERTY
thisRef: ERROR_CALL 'Unresolved reference: this#' type=<root>.C
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
property: PROPERTY_REFERENCE 'public final test2: kotlin.Int [delegated,val]' field='FIELD DELEGATE name:test2$delegate type:kotlin.Lazy<kotlin.Int> visibility:private [final]' getter=null setter=null type=kotlin.reflect.KProperty<*> origin=null
PROPERTY name:test3 visibility:public modality:FINAL [delegated,var]
FIELD DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]
@@ -61,7 +61,7 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-test3> (): IrErrorType declared in <root>.C'
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: this#' type=<root>.C
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field='FIELD DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]' getter=null setter=null type=kotlin.reflect.KProperty<*> origin=null
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test3> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:IrErrorType) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [delegated,var]
@@ -69,7 +69,7 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
BLOCK_BODY
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: this#' type=<root>.C
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field='FIELD DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]' getter='public final fun <get-test3> (): IrErrorType declared in <root>.C' setter=null type=kotlin.reflect.KProperty<*> origin=null
GET_VAR '<set-?>: IrErrorType declared in <root>.C.<set-test3>' type=IrErrorType origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
@@ -9,6 +9,7 @@ FILE fqName:interop fileName:/Definitions.kt
FIELD PROPERTY_BACKING_FIELD name:KT_CONSTANT type:kotlin.String? visibility:public [final]
EXPRESSION_BODY
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:CONSTANT type:kotlin.String? visibility:public [final,static]' type=kotlin.String? origin=GET_PROPERTY
receiver: GET_OBJECT 'CLASS CLASS name:Interface modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Any]' type=kotlin.Unit
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-KT_CONSTANT> visibility:public modality:FINAL <> ($this:interop.Definitions) returnType:kotlin.String?
correspondingProperty: PROPERTY name:KT_CONSTANT visibility:public modality:FINAL [const,val]
$this: VALUE_PARAMETER name:<this> type:interop.Definitions
@@ -20,6 +21,7 @@ FILE fqName:interop fileName:/Definitions.kt
FIELD PROPERTY_BACKING_FIELD name:ktValue type:kotlin.String? visibility:public [final]
EXPRESSION_BODY
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:CONSTANT type:kotlin.String? visibility:public [final,static]' type=kotlin.String? origin=GET_PROPERTY
receiver: GET_OBJECT 'CLASS CLASS name:Interface modality:OPEN visibility:public/*package*/ superTypes:[kotlin.Any]' type=kotlin.Unit
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-ktValue> visibility:public modality:FINAL <> ($this:interop.Definitions) returnType:kotlin.String?
correspondingProperty: PROPERTY name:ktValue visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:interop.Definitions
@@ -42,7 +42,7 @@ FILE fqName:<root> fileName:/packageLevelProperties.kt
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [var]
VALUE_PARAMETER name:value index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Int visibility:public [static]' type=kotlin.Int origin=null
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.Int visibility:public [static]' type=kotlin.Unit origin=null
value: GET_VAR 'value: kotlin.Int declared in <root>.<set-test4>' type=kotlin.Int origin=null
PROPERTY name:test5 visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:test5 type:kotlin.Int visibility:public [static]
@@ -37,14 +37,14 @@ FILE fqName:<root> fileName:/differentReceivers.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun provideDelegate (host: kotlin.Any?, p: kotlin.Any): kotlin.String declared in <root>'
CALL 'public final fun <get-value> (): kotlin.String declared in <root>.MyClass' type=kotlin.String origin=null
$this: ERROR_CALL 'Unresolved reference: this#' type=<root>.MyClass
$this: GET_VAR '<this>: <root>.MyClass declared in <root>.provideDelegate' type=<root>.MyClass origin=null
FUN name:getValue visibility:public modality:FINAL <> ($receiver:kotlin.String, receiver:kotlin.Any?, p:kotlin.Any) returnType:kotlin.String
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String
VALUE_PARAMETER name:receiver index:0 type:kotlin.Any?
VALUE_PARAMETER name:p index:1 type:kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun getValue (receiver: kotlin.Any?, p: kotlin.Any): kotlin.String declared in <root>'
ERROR_CALL 'Unresolved reference: this#' type=kotlin.String
GET_VAR '<this>: kotlin.String declared in <root>.getValue' type=kotlin.String origin=null
PROPERTY name:testO visibility:public modality:FINAL [delegated,val]
FIELD DELEGATE name:testO$delegate type:kotlin.String visibility:private [final,static]
EXPRESSION_BODY
@@ -37,14 +37,14 @@ FILE fqName:<root> fileName:/localDifferentReceivers.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun provideDelegate (host: kotlin.Any?, p: kotlin.Any): kotlin.String declared in <root>'
CALL 'public final fun <get-value> (): kotlin.String declared in <root>.MyClass' type=kotlin.String origin=null
$this: ERROR_CALL 'Unresolved reference: this#' type=<root>.MyClass
$this: GET_VAR '<this>: <root>.MyClass declared in <root>.provideDelegate' type=<root>.MyClass origin=null
FUN name:getValue visibility:public modality:FINAL <> ($receiver:kotlin.String, receiver:kotlin.Any?, p:kotlin.Any) returnType:kotlin.String
$receiver: VALUE_PARAMETER name:<this> type:kotlin.String
VALUE_PARAMETER name:receiver index:0 type:kotlin.Any?
VALUE_PARAMETER name:p index:1 type:kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun getValue (receiver: kotlin.Any?, p: kotlin.Any): kotlin.String declared in <root>'
ERROR_CALL 'Unresolved reference: this#' type=kotlin.String
GET_VAR '<this>: kotlin.String declared in <root>.getValue' type=kotlin.String origin=null
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:testO type:kotlin.String [val]
@@ -88,7 +88,7 @@ FILE fqName:<root> fileName:/member.kt
CALL 'public final fun provideDelegate (thisRef: kotlin.Any?, property: kotlin.Any?): <root>.Delegate declared in <root>.DelegateProvider' type=<root>.Delegate origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> (value: kotlin.String) [primary] declared in <root>.DelegateProvider' type=<root>.DelegateProvider origin=null
value: CONST String type=kotlin.String value="OK"
thisRef: ERROR_CALL 'Unresolved reference: this#' type=<root>.Host
thisRef: GET_VAR '<this>: <root>.Host declared in <root>.Host' type=<root>.Host origin=null
property: PROPERTY_REFERENCE 'public final testMember: kotlin.String [delegated,val]' field=null getter=null setter=null type=kotlin.reflect.KProperty<*> origin=null
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-testMember> visibility:public modality:FINAL <> ($this:<root>.Host) returnType:kotlin.String
correspondingProperty: PROPERTY name:testMember visibility:public modality:FINAL [delegated,val]
@@ -97,7 +97,7 @@ FILE fqName:<root> fileName:/member.kt
RETURN type=kotlin.Nothing from='public final fun <get-testMember> (): kotlin.String declared in <root>.Host'
CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.Any?): kotlin.String declared in <root>.Delegate' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD DELEGATE name:testMember$delegate type:<root>.Delegate visibility:private [final]' type=<root>.Delegate origin=GET_PROPERTY
thisRef: ERROR_CALL 'Unresolved reference: this#' type=<root>.Host
thisRef: GET_VAR '<this>: <root>.Host declared in <root>.Host' type=<root>.Host origin=null
property: PROPERTY_REFERENCE 'public final testMember: kotlin.String [delegated,val]' field='FIELD DELEGATE name:testMember$delegate type:<root>.Delegate visibility:private [final]' getter=null setter=null type=kotlin.reflect.KProperty<*> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
overridden:
@@ -53,13 +53,13 @@ FILE fqName:<root> fileName:/memberExtension.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun provideDelegate (host: kotlin.Any?, p: kotlin.Any): <root>.Host.StringDelegate declared in <root>.Host'
CONSTRUCTOR_CALL 'public constructor <init> (s: kotlin.String) [primary] declared in <root>.Host.StringDelegate' type=<root>.Host.StringDelegate origin=null
s: ERROR_CALL 'Unresolved reference: this#' type=kotlin.String
s: GET_VAR '<this>: kotlin.String declared in <root>.Host.provideDelegate' type=kotlin.String origin=null
PROPERTY name:plusK visibility:public modality:FINAL [delegated,val]
FIELD DELEGATE name:plusK$delegate type:<root>.Host.StringDelegate visibility:private [final]
EXPRESSION_BODY
CALL 'public final fun provideDelegate (host: kotlin.Any?, p: kotlin.Any): <root>.Host.StringDelegate declared in <root>.Host' type=<root>.Host.StringDelegate origin=null
$this: CONST String type=kotlin.String value="K"
host: ERROR_CALL 'Unresolved reference: this#' type=<root>.Host
host: GET_VAR '<this>: <root>.Host declared in <root>.Host' type=<root>.Host origin=null
p: PROPERTY_REFERENCE 'public final plusK: IrErrorType [delegated,val]' field=null getter=null setter=null type=kotlin.reflect.KProperty<*> origin=null
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-plusK> visibility:public modality:FINAL <> ($this:<root>.Host) returnType:IrErrorType
correspondingProperty: PROPERTY name:plusK visibility:public modality:FINAL [delegated,val]
@@ -67,7 +67,7 @@ FILE fqName:<root> fileName:/memberExtension.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-plusK> (): IrErrorType declared in <root>.Host'
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/Host.StringDelegate.getValue]>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: this#' type=<root>.Host
GET_VAR '<this>: <root>.Host declared in <root>.Host' type=<root>.Host origin=null
PROPERTY_REFERENCE 'public final plusK: IrErrorType [delegated,val]' field='FIELD DELEGATE name:plusK$delegate type:<root>.Host.StringDelegate visibility:private [final]' getter=null setter=null type=kotlin.reflect.KProperty<*> origin=null
PROPERTY name:ok visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:ok type:IrErrorType visibility:public [final]