[FIR] Add // FIR_DUMP to some implicit invoke tests

Although these dumps don't really show if
something is a `FirFunctionCall` or a
`FirImplicitInvokeCall`, they do show what
goes into the receiver, and what are value
arguments.
This commit is contained in:
Nikolay Lunyak
2024-01-22 17:51:16 +02:00
committed by Space Team
parent 9b786d35f8
commit 3024ec3da3
14 changed files with 83 additions and 0 deletions
@@ -1,3 +1,5 @@
// FIR_DUMP
fun test1(f: String.() -> Unit) {
(f)<!NO_VALUE_FOR_PARAMETER!>()<!>
@@ -0,0 +1,9 @@
FILE: receiverPresenceErrorForInvoke.fir.kt
public final fun test1(f: R|kotlin/String.() -> kotlin/Unit|): R|kotlin/Unit| {
R|<local>/f|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|><Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): kotlin/Function1.invoke>#|()
R|<local>/f|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|><Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): kotlin/Function1.invoke>#|()
}
public final fun test2(f: R|(kotlin/Int) -> kotlin/Int|): R|kotlin/Unit| {
IntegerLiteral(1).<Unresolved name: f>#(Int(2))
R|<local>/f|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Int|><Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): kotlin/Function1.invoke>#|(Int(2), Int(2))
}
@@ -1,3 +1,5 @@
// FIR_DUMP
fun test1(f: String.() -> Unit) {
(f)<!NO_VALUE_FOR_PARAMETER!>()<!>
@@ -1,3 +1,4 @@
// FIR_DUMP
fun test1() {
1. <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>(fun String.(i: Int) = i )<!>(1)
@@ -0,0 +1,25 @@
FILE: wrongReceiverForInvokeOnExpression.fir.kt
public final fun test1(): R|kotlin/Unit| {
fun R|kotlin/String|.<anonymous>(i: R|kotlin/Int|): R|kotlin/Int| <inline=Unknown> {
^ R|<local>/i|
}
.R|SubstitutionOverride<kotlin/Function2.invoke: R|kotlin/Int|><None of the following candidates is applicable because of receiver type mismatch: [kotlin/Function2.invoke]>#|(Int(1), Int(1))
label@fun R|kotlin/String|.<anonymous>(i: R|kotlin/Int|): R|kotlin/Int| <inline=Unknown> {
^@label R|<local>/i|
}
.R|SubstitutionOverride<kotlin/Function2.invoke: R|kotlin/Int|><None of the following candidates is applicable because of receiver type mismatch: [kotlin/Function2.invoke]>#|(Int(1), Int(1))
}
public final fun test2(f: R|kotlin/String.(kotlin/Int) -> kotlin/Unit|): R|kotlin/Unit| {
R|<local>/f|.R|SubstitutionOverride<kotlin/Function2.invoke: R|kotlin/Unit|><None of the following candidates is applicable because of receiver type mismatch: [kotlin/Function2.invoke]>#|(Int(11), Int(1))
R|<local>/f|.R|SubstitutionOverride<kotlin/Function2.invoke: R|kotlin/Unit|><Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): kotlin/Function2.invoke>#|(Int(11))
}
public final fun test3(): R|kotlin/Unit| {
local final fun foo(): R|kotlin/String.(kotlin/Int) -> kotlin/Unit| {
^foo fun R|kotlin/String|.<anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| <inline=Unknown> {
^ Unit
}
}
R|<local>/foo|().R|SubstitutionOverride<kotlin/Function2.invoke: R|kotlin/Unit|><None of the following candidates is applicable because of receiver type mismatch: [kotlin/Function2.invoke]>#|(Int(1), Int(1))
}
@@ -1,3 +1,5 @@
// FIR_DUMP
fun test1() {
1. <!FUNCTION_EXPECTED!>(fun String.(i: Int) = i )<!>(1)
1.<!FUNCTION_EXPECTED!>(label@ fun String.(i: Int) = i )<!>(1)