FIR2IR: declare receivers for all accessors of extension properties

Before this commit, extension receivers were declared only for
properties with container source, which is strange & inconsistent.
Now we declare accessor extension receiver iff corresponding property
has extension receiver.
This commit is contained in:
Mikhail Glukhikh
2020-02-25 11:57:16 +03:00
parent 8c155578f7
commit d1fac6dce1
32 changed files with 158 additions and 124 deletions
@@ -19,13 +19,15 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
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 [var]
FUN name:<get-p> visibility:public modality:FINAL <> () returnType:kotlin.Int
FUN name:<get-p> visibility:public modality:FINAL <> ($receiver:test.C?) returnType:kotlin.Int
correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [var]
$receiver: VALUE_PARAMETER name:<this> type:test.C?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-p> (): kotlin.Int declared in test'
CONST Int type=kotlin.Int value=42
FUN name:<set-p> visibility:public modality:FINAL <> (value:kotlin.Int) returnType:kotlin.Unit
FUN name:<set-p> visibility:public modality:FINAL <> ($receiver:test.C?, value:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:p visibility:public modality:FINAL [var]
$receiver: VALUE_PARAMETER name:<this> type:test.C?
VALUE_PARAMETER name:value index:0 type:kotlin.Int
BLOCK_BODY
FUN name:inc visibility:public modality:FINAL <> ($receiver:kotlin.Int?) returnType:kotlin.Int? [operator]
@@ -50,6 +52,7 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
BLOCK_BODY
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int? [val]
CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int? origin=null
$receiver: GET_VAR 'nc: test.C? declared in test.testProperty' type=test.C? origin=null
ERROR_CALL 'Unresolved reference: R|test/p|' type=IrErrorType
GET_VAR 'val tmp_0: kotlin.Int? [val] declared in test.testProperty' type=kotlin.Int? origin=null
FUN name:testArrayAccess visibility:public modality:FINAL <> (nc:test.C?) returnType:kotlin.Unit
@@ -58,9 +61,11 @@ FILE fqName:test fileName:/safeCallWithIncrementDecrement.kt
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
CALL 'public final fun get (index: kotlin.Int): kotlin.Int [operator] declared in test' type=kotlin.Int origin=null
$receiver: CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int? origin=null
$receiver: GET_VAR 'nc: test.C? declared in test.testArrayAccess' type=test.C? origin=null
index: CONST Int type=kotlin.Int value=0
CALL 'public final fun set (index: kotlin.Int, value: kotlin.Int): kotlin.Unit [operator] declared in test' type=kotlin.Unit origin=null
$receiver: CALL 'public final fun <get-p> (): kotlin.Int declared in test' type=kotlin.Int? origin=null
$receiver: GET_VAR 'nc: test.C? declared in test.testArrayAccess' type=test.C? origin=null
index: CONST Int type=kotlin.Int value=0
value: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_1: kotlin.Int [val] declared in test.testArrayAccess' type=kotlin.Int origin=null