FIR: more accurate handling of dispatch receiver values

This commit fixes resolve priorities (see changed test data),
e.g. top-levels now have less priority than implicit receiver members
This commit is contained in:
Mikhail Glukhikh
2019-08-20 18:19:47 +03:00
parent fcb0b1b5eb
commit 5d6a526eec
11 changed files with 179 additions and 81 deletions
@@ -1,9 +1,9 @@
FILE fqName:<root> fileName:/implicitCastToNonNull.kt
FUN name:test1 visibility:public modality:FINAL <> (x:kotlin.String?) returnType:kotlin.Int
FUN name:test1 visibility:public modality:FINAL <> (x:kotlin.String?) returnType:IrErrorType
VALUE_PARAMETER name:x index:0 type:kotlin.String?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test1 (x: kotlin.String?): kotlin.Int declared in <root>'
WHEN type=kotlin.Int origin=IF
RETURN type=kotlin.Nothing from='public final fun test1 (x: kotlin.String?): IrErrorType declared in <root>'
WHEN type=IrErrorType origin=IF
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'x: kotlin.String? declared in <root>.test1' type=kotlin.String? origin=null
@@ -11,13 +11,13 @@ FILE fqName:<root> fileName:/implicitCastToNonNull.kt
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: ERROR_CALL 'No getter found for R|kotlin/String.length|' type=kotlin.Int
FUN name:test2 visibility:public modality:FINAL <T> (x:T of <root>.test2) returnType:kotlin.Int
then: ERROR_CALL 'Unresolved reference: <Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#' type=IrErrorType
FUN name:test2 visibility:public modality:FINAL <T> (x:T of <root>.test2) returnType:IrErrorType
TYPE_PARAMETER name:T index:0 variance: superTypes:[]
VALUE_PARAMETER name:x index:0 type:T of <root>.test2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test2 <T> (x: T of <root>.test2): kotlin.Int declared in <root>'
WHEN type=kotlin.Int origin=IF
RETURN type=kotlin.Nothing from='public final fun test2 <T> (x: T of <root>.test2): IrErrorType declared in <root>'
WHEN type=IrErrorType origin=IF
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'x: T of <root>.test2 declared in <root>.test2' type=T of <root>.test2 origin=null
@@ -25,7 +25,7 @@ FILE fqName:<root> fileName:/implicitCastToNonNull.kt
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: ERROR_CALL 'No getter found for R|kotlin/CharSequence.length|' type=kotlin.Int
then: ERROR_CALL 'Unresolved reference: <Inapplicable(WRONG_RECEIVER): [kotlin/CharSequence.length]>#' type=IrErrorType
FUN name:test3 visibility:public modality:FINAL <T> (x:kotlin.Any) returnType:IrErrorType [inline]
TYPE_PARAMETER name:T index:0 variance: superTypes:[]
VALUE_PARAMETER name:x index:0 type:kotlin.Any