[FIR2IR]: fix translation of this references in instance methods

Currently FirThisReceiverExpression of instance methods are translated
to references of the class' thisReceiver,
not the method's dispatch receiver,
which causes problems with IrFrameMap::typeOf,
as the class' thisReceiver is not in the typeMap.

This commit translates non-qualified "this" references of
instance methods to references of the methods' dispatch receiver.
This commit is contained in:
Juan Chen
2020-01-08 16:20:45 -08:00
committed by Mikhail Glukhikh
parent 6b4e5bc2f0
commit 573188bdc4
112 changed files with 102 additions and 200 deletions
@@ -29,13 +29,13 @@ FILE fqName:<root> fileName:/lambdaInDataClassDefaultParameter.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Function2<<root>.A, kotlin.String, kotlin.Unit> declared in <root>.A'
CALL 'public final fun <get-runA> (): kotlin.Function2<<root>.A, kotlin.String, kotlin.Unit> declared in <root>.A' type=kotlin.Function2<<root>.A, kotlin.String, kotlin.Unit> origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A' type=<root>.A origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A.component1' type=<root>.A origin=null
FUN name:copy visibility:public modality:FINAL <> ($this:<root>.A, runA:kotlin.Function2<<root>.A, kotlin.String, kotlin.Unit>) returnType:<root>.A
$this: VALUE_PARAMETER name:<this> type:<root>.A
VALUE_PARAMETER name:runA index:0 type:kotlin.Function2<<root>.A, kotlin.String, kotlin.Unit>
EXPRESSION_BODY
CALL 'public final fun <get-runA> (): kotlin.Function2<<root>.A, kotlin.String, kotlin.Unit> declared in <root>.A' type=kotlin.Function2<<root>.A, kotlin.String, kotlin.Unit> origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A' type=<root>.A origin=null
$this: GET_VAR '<this>: <root>.A declared in <root>.A.copy' type=<root>.A origin=null
BLOCK_BODY
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
@@ -82,13 +82,13 @@ FILE fqName:<root> fileName:/lambdaInDataClassDefaultParameter.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Any declared in <root>.B'
CALL 'public final fun <get-x> (): kotlin.Any declared in <root>.B' type=kotlin.Any origin=null
$this: GET_VAR '<this>: <root>.B declared in <root>.B' type=<root>.B origin=null
$this: GET_VAR '<this>: <root>.B declared in <root>.B.component1' type=<root>.B origin=null
FUN name:copy visibility:public modality:FINAL <> ($this:<root>.B, x:kotlin.Any) returnType:<root>.B
$this: VALUE_PARAMETER name:<this> type:<root>.B
VALUE_PARAMETER name:x index:0 type:kotlin.Any
EXPRESSION_BODY
CALL 'public final fun <get-x> (): kotlin.Any declared in <root>.B' type=kotlin.Any origin=null
$this: GET_VAR '<this>: <root>.B declared in <root>.B' type=<root>.B origin=null
$this: GET_VAR '<this>: <root>.B declared in <root>.B.copy' type=<root>.B origin=null
BLOCK_BODY
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden: