[FIR] Fix FP UNRESOLVED_REFERENCE on implicit invoke() after a safe call

`invoke()` function of functional types is always defined
in such a way that its explicit receiver comes as the first
value parameter. Extension-function types contain the very
same `invoke` function, they just additionally have the
`@ExtensionFunctionType` annotation.

In the related test there is such an `invoke` function and
in the presented call its explicit receiver is the anonymous
function `fun Int.() = 1` itself. So the safe-checked `1`

^KT-60056
This commit is contained in:
Nikolay Lunyak
2023-11-22 14:16:03 +02:00
committed by Space Team
parent 502b422b6b
commit e4781d8508
2 changed files with 14 additions and 3 deletions
@@ -81,6 +81,6 @@ fun test() {
val i : Int? = null
i.<!UNSAFE_IMPLICIT_INVOKE_CALL!>(fun Int.() = 1)<!>();
<!INAPPLICABLE_CANDIDATE!>{}<!><Int>()
1<!UNNECESSARY_SAFE_CALL!>?.<!>(<!UNRESOLVED_REFERENCE!>fun Int.() = 1<!>)()
1<!UNNECESSARY_SAFE_CALL!>?.<!>(fun Int.() = 1)()
1.<!NO_RECEIVER_ALLOWED!>{}<!>()
}