[FIR] Analyze lambda arguments in erroneously resolved calls

This commit is contained in:
Dmitriy Novozhilov
2019-11-18 14:23:23 +03:00
parent a85ece1d83
commit d56412e397
17 changed files with 279 additions and 217 deletions
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.copy
import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction
import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl
import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
import org.jetbrains.kotlin.fir.expressions.FirResolvable import org.jetbrains.kotlin.fir.expressions.FirResolvable
import org.jetbrains.kotlin.fir.expressions.FirStatement import org.jetbrains.kotlin.fir.expressions.FirStatement
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
@@ -54,7 +55,14 @@ class FirCallCompleter(
if (call is FirExpression) { if (call is FirExpression) {
call.resultType = typeRef call.resultType = typeRef
} }
return call return if (call is FirFunctionCall) {
call.transformArguments(
transformer,
ResolutionMode.WithExpectedType(typeRef.resolvedTypeFromPrototype(session.builtinTypes.nullableAnyType.type))
) as T
} else {
call
}
} }
val candidate = call.candidate() ?: return call val candidate = call.candidate() ?: return call
val initialSubstitutor = candidate.substitutor val initialSubstitutor = candidate.substitutor
@@ -3,7 +3,7 @@ FILE: incorrectFunctionalType.kt
fun <anonymous>(): R|kotlin/Unit| { fun <anonymous>(): R|kotlin/Unit| {
} }
public final fun test(): R|kotlin/Unit| { public final fun test(): R|kotlin/Unit| {
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(<L> = foo@fun <implicit>.<anonymous>(): R|kotlin/String| { <Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(<L> = foo@fun <anonymous>(): R|kotlin/String| {
this#.R|kotlin/plus|(<Unresolved name: it>#) this#.R|kotlin/plus|(<Unresolved name: it>#)
} }
) )
+8 -8
View File
@@ -18,14 +18,14 @@ FILE: lambda.kt
Unit Unit
} }
) )
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(Int(1), <L> = foo@fun <implicit>.<anonymous>(): R|kotlin/Unit| { <Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(Int(1), <L> = foo@fun <anonymous>(): R|kotlin/Unit| {
Unit Unit
} }
) )
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(f = foo@fun <implicit>.<anonymous>(): R|kotlin/Unit| { <Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(f = foo@fun <anonymous>(): R|kotlin/Unit| {
Unit Unit
} }
, <L> = foo@fun <implicit>.<anonymous>(): R|kotlin/Unit| { , <L> = foo@fun <anonymous>(): R|kotlin/Unit| {
Unit Unit
} }
) )
@@ -45,11 +45,11 @@ FILE: lambda.kt
Unit Unit
} }
) )
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(<L> = bar@fun <implicit>.<anonymous>(): R|kotlin/Unit| { <Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(<L> = bar@fun <anonymous>(): R|kotlin/Unit| {
Unit Unit
} }
) )
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(bar@fun <implicit>.<anonymous>(): R|kotlin/Unit| { <Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(bar@fun <anonymous>(): R|kotlin/Unit| {
Unit Unit
} }
) )
@@ -61,15 +61,15 @@ FILE: lambda.kt
Unit Unit
} }
, Boolean(false)) , Boolean(false))
<Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(<L> = baz@fun <implicit>.<anonymous>(): R|kotlin/Unit| { <Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(<L> = baz@fun <anonymous>(): R|kotlin/Unit| {
Unit Unit
} }
) )
<Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(<L> = baz@fun <implicit>.<anonymous>(): R|kotlin/Unit| { <Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(<L> = baz@fun <anonymous>(): R|kotlin/Unit| {
Unit Unit
} }
) )
<Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(other = Boolean(false), <L> = baz@fun <implicit>.<anonymous>(): R|kotlin/Unit| { <Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(other = Boolean(false), <L> = baz@fun <anonymous>(): R|kotlin/Unit| {
Unit Unit
} }
) )
@@ -0,0 +1,14 @@
fun <R> materialize(): R = <!UNRESOLVED_REFERENCE!>null!!<!>
fun test_1() {
<!UNRESOLVED_REFERENCE!>myRun<!> {
val x = 1
x * 2
}
}
fun test_2() {
<!UNRESOLVED_REFERENCE!>myRun<!> {
materialize()
}
}
@@ -0,0 +1,25 @@
FILE: lambdaInUnresolvedCall.kt
public final fun <R> materialize(): R|R| {
^materialize when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
==($subj$, Null(null)) -> {
throw <Unresolved name: KotlinNullPointerException>#()
}
else -> {
R|<local>/<bangbang>|
}
}
}
public final fun test_1(): R|kotlin/Unit| {
<Unresolved name: myRun>#(<L> = myRun@fun <anonymous>(): R|kotlin/Int| {
lval x: R|kotlin/Int| = Int(1)
R|<local>/x|.R|kotlin/Int.times|(Int(2))
}
)
}
public final fun test_2(): R|kotlin/Unit| {
<Unresolved name: myRun>#(<L> = myRun@fun <anonymous>(): R|kotlin/Any?| {
R|/materialize|<R|kotlin/Any?|>()
}
)
}
+204 -194
View File
@@ -24,58 +24,62 @@ digraph complex_kt {
10 [label="Access variable <Unresolved name: HttpRequests>#"]; 10 [label="Access variable <Unresolved name: HttpRequests>#"];
11 [label="Access variable R|<local>/url|"]; 11 [label="Access variable R|<local>/url|"];
12 [label="Access variable R|<local>/url|"]; 12 [label="Access variable R|<local>/url|"];
13 [label="Function call: <Unresolved name: HttpRequests>#.<Unresolved name: request>#(R|<local>/url|)"]; 13 [label="Access variable R|<local>/url|"];
14 [label="Function call: <Unresolved name: HttpRequests>#.<Unresolved name: request>#(R|<local>/url|).<Unresolved name: connect>#(<L> = connect@fun <implicit>.<anonymous>(): <ERROR TYPE REF: Unresolved name: fromJson> { 14 [label="Function call: <Unresolved name: HttpRequests>#.<Unresolved name: request>#(R|<local>/url|)"];
15 [label="Function call: <Unresolved name: HttpRequests>#.<Unresolved name: request>#(R|<local>/url|).<Unresolved name: connect>#(<L> = connect@fun <anonymous>(): <ERROR TYPE REF: Unresolved name: fromJson> {
<Unresolved name: GsonBuilder>#().<Unresolved name: create>#().<Unresolved name: fromJson>#(<Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#(), <getClass>(<Inapplicable(PARAMETER_MAPPING_ERROR): [kotlin/Array.Array]>#<R|class error: Symbol not found, for `PluginDTO`|>()).<Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#) <Unresolved name: GsonBuilder>#().<Unresolved name: create>#().<Unresolved name: fromJson>#(<Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#(), <getClass>(<Inapplicable(PARAMETER_MAPPING_ERROR): [kotlin/Array.Array]>#<R|class error: Symbol not found, for `PluginDTO`|>()).<Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#)
} }
)"]; )"];
15 [label="Exit block"]; 16 [label="Exit block"];
} }
16 [label="Try main block exit"]; 17 [label="Try main block exit"];
} }
subgraph cluster_4 { subgraph cluster_4 {
color=blue color=blue
17 [label="Catch enter"]; 18 [label="Catch enter"];
subgraph cluster_5 { subgraph cluster_5 {
color=blue color=blue
18 [label="Enter block"]; 19 [label="Enter block"];
19 [label="Const: String(Can't parse json response)"]; 20 [label="Const: String(Can't parse json response)"];
20 [label="Access variable R|<local>/syntaxException|"]; 21 [label="Access variable R|<local>/syntaxException|"];
21 [label="Const: String(Can't parse json response)"]; 22 [label="Const: String(Can't parse json response)"];
22 [label="Access variable R|<local>/syntaxException|"]; 23 [label="Access variable R|<local>/syntaxException|"];
23 [label="Function call: <Unresolved name: ResponseParseException>#(String(Can't parse json response), R|<local>/syntaxException|)"]; 24 [label="Const: String(Can't parse json response)"];
24 [label="Throw: throw <Unresolved name: ResponseParseException>#(String(Can't parse json response), R|<local>/syntaxException|)"]; 25 [label="Access variable R|<local>/syntaxException|"];
25 [label="Stub" style="filled" fillcolor=gray]; 26 [label="Function call: <Unresolved name: ResponseParseException>#(String(Can't parse json response), R|<local>/syntaxException|)"];
26 [label="Exit block" style="filled" fillcolor=gray]; 27 [label="Throw: throw <Unresolved name: ResponseParseException>#(String(Can't parse json response), R|<local>/syntaxException|)"];
28 [label="Stub" style="filled" fillcolor=gray];
29 [label="Exit block" style="filled" fillcolor=gray];
} }
27 [label="Catch exit" style="filled" fillcolor=gray]; 30 [label="Catch exit" style="filled" fillcolor=gray];
} }
subgraph cluster_6 { subgraph cluster_6 {
color=blue color=blue
28 [label="Catch enter"]; 31 [label="Catch enter"];
subgraph cluster_7 { subgraph cluster_7 {
color=blue color=blue
29 [label="Enter block"]; 32 [label="Enter block"];
30 [label="Access variable R|<local>/ioException|"]; 33 [label="Access variable R|<local>/ioException|"];
31 [label="Access variable R|<local>/ioException|"]; 34 [label="Access variable R|<local>/ioException|"];
32 [label="Function call: <Unresolved name: IOException>#(R|<local>/ioException|)"]; 35 [label="Access variable R|<local>/ioException|"];
33 [label="Throw: throw <Unresolved name: IOException>#(R|<local>/ioException|)"]; 36 [label="Function call: <Unresolved name: IOException>#(R|<local>/ioException|)"];
34 [label="Stub" style="filled" fillcolor=gray]; 37 [label="Throw: throw <Unresolved name: IOException>#(R|<local>/ioException|)"];
35 [label="Exit block" style="filled" fillcolor=gray]; 38 [label="Stub" style="filled" fillcolor=gray];
39 [label="Exit block" style="filled" fillcolor=gray];
} }
36 [label="Catch exit" style="filled" fillcolor=gray]; 40 [label="Catch exit" style="filled" fillcolor=gray];
} }
37 [label="Try expression exit"]; 41 [label="Try expression exit"];
} }
38 [label="Variable declaration: lval pluginDTOs: R|kotlin/Array<class error: Symbol not found, for `PluginDTO`>|"]; 42 [label="Variable declaration: lval pluginDTOs: R|kotlin/Array<class error: Symbol not found, for `PluginDTO`>|"];
39 [label="Exit function fetchPluginReleaseDate" style="filled" fillcolor=red]; 43 [label="Exit function fetchPluginReleaseDate" style="filled" fillcolor=red];
} }
subgraph cluster_8 { subgraph cluster_8 {
color=blue color=blue
40 [label="Enter annotation"]; 44 [label="Enter annotation"];
41 [label="Access variable <Unresolved name: IOException>#"]; 45 [label="Access variable <Unresolved name: IOException>#"];
42 [label="Access variable <Unresolved name: ResponseParseException>#"]; 46 [label="Access variable <Unresolved name: ResponseParseException>#"];
43 [label="Exit annotation"]; 47 [label="Exit annotation"];
} }
0 -> {1}; 0 -> {1};
@@ -86,7 +90,7 @@ digraph complex_kt {
5 -> {6}; 5 -> {6};
6 -> {7}; 6 -> {7};
7 -> {8}; 7 -> {8};
8 -> {39 28 17 9}; 8 -> {43 31 18 9};
9 -> {10}; 9 -> {10};
10 -> {11}; 10 -> {11};
11 -> {12}; 11 -> {12};
@@ -94,151 +98,157 @@ digraph complex_kt {
13 -> {14}; 13 -> {14};
14 -> {15}; 14 -> {15};
15 -> {16}; 15 -> {16};
16 -> {37}; 16 -> {17};
17 -> {39 18}; 17 -> {41};
18 -> {19}; 18 -> {43 19};
19 -> {20}; 19 -> {20};
20 -> {21}; 20 -> {21};
21 -> {22}; 21 -> {22};
22 -> {23}; 22 -> {23};
23 -> {24}; 23 -> {24};
24 -> {39}; 24 -> {25};
24 -> {25} [style=dotted]; 25 -> {26};
25 -> {26} [style=dotted]; 26 -> {27};
26 -> {27} [style=dotted]; 27 -> {43};
27 -> {37} [style=dotted]; 27 -> {28} [style=dotted];
28 -> {39 29}; 28 -> {29} [style=dotted];
29 -> {30}; 29 -> {30} [style=dotted];
30 -> {31}; 30 -> {41} [style=dotted];
31 -> {32}; 31 -> {43 32};
32 -> {33}; 32 -> {33};
33 -> {39}; 33 -> {34};
33 -> {34} [style=dotted]; 34 -> {35};
34 -> {35} [style=dotted]; 35 -> {36};
35 -> {36} [style=dotted]; 36 -> {37};
36 -> {37} [style=dotted]; 37 -> {43};
37 -> {38}; 37 -> {38} [style=dotted];
38 -> {39}; 38 -> {39} [style=dotted];
39 -> {40}; 39 -> {40} [style=dotted];
40 -> {41}; 40 -> {41} [style=dotted];
41 -> {42}; 41 -> {42};
42 -> {43}; 42 -> {43};
43 -> {44};
subgraph cluster_9 {
color=red
44 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
45 [label="Function call: <Unresolved name: GsonBuilder>#()"];
46 [label="Function call: <Unresolved name: GsonBuilder>#().<Unresolved name: create>#()"];
47 [label="Access variable <Unresolved name: it>#"];
48 [label="Access variable <Unresolved name: inputStream>#"];
49 [label="Function call: <Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#()"];
50 [label="Function call: <Inapplicable(PARAMETER_MAPPING_ERROR): [kotlin/Array.Array]>#<R|class error: Symbol not found, for `PluginDTO`|>()"];
51 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#"];
52 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#"];
53 [label="Function call: <Unresolved name: GsonBuilder>#().<Unresolved name: create>#().<Unresolved name: fromJson>#(<Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#(), <getClass>(<Inapplicable(PARAMETER_MAPPING_ERROR): [kotlin/Array.Array]>#<R|class error: Symbol not found, for `PluginDTO`|>()).<Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#)"];
54 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
44 -> {45}; 44 -> {45};
45 -> {46}; 45 -> {46};
46 -> {47}; 46 -> {47};
47 -> {48};
subgraph cluster_9 {
color=red
48 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
49 [label="Function call: <Unresolved name: GsonBuilder>#()"];
50 [label="Function call: <Unresolved name: GsonBuilder>#().<Unresolved name: create>#()"];
51 [label="Access variable <Unresolved name: it>#"];
52 [label="Access variable <Unresolved name: inputStream>#"];
53 [label="Function call: <Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#()"];
54 [label="Function call: <Inapplicable(PARAMETER_MAPPING_ERROR): [kotlin/Array.Array]>#<R|class error: Symbol not found, for `PluginDTO`|>()"];
55 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#"];
56 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#"];
57 [label="Access variable <Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#"];
58 [label="Function call: <Unresolved name: GsonBuilder>#().<Unresolved name: create>#().<Unresolved name: fromJson>#(<Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#(), <getClass>(<Inapplicable(PARAMETER_MAPPING_ERROR): [kotlin/Array.Array]>#<R|class error: Symbol not found, for `PluginDTO`|>()).<Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#)"];
59 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
48 -> {49}; 48 -> {49};
49 -> {50}; 49 -> {50};
50 -> {51}; 50 -> {51};
51 -> {52}; 51 -> {52};
52 -> {53}; 52 -> {53};
53 -> {54}; 53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
subgraph cluster_10 { subgraph cluster_10 {
color=red color=red
55 [label="Enter function close" style="filled" fillcolor=red]; 60 [label="Enter function close" style="filled" fillcolor=red];
56 [label="Exit function close" style="filled" fillcolor=red]; 61 [label="Exit function close" style="filled" fillcolor=red];
} }
55 -> {56}; 60 -> {61};
subgraph cluster_11 { subgraph cluster_11 {
color=red color=red
57 [label="Enter function closeFinally" style="filled" fillcolor=red]; 62 [label="Enter function closeFinally" style="filled" fillcolor=red];
subgraph cluster_12 { subgraph cluster_12 {
color=blue color=blue
58 [label="Enter when"]; 63 [label="Enter when"];
subgraph cluster_13 { subgraph cluster_13 {
color=blue
59 [label="Enter when branch condition "];
60 [label="Access variable this@R|/closeFinally|"];
61 [label="Const: Null(null)"];
62 [label="Operator =="];
63 [label="Exit when branch condition"];
}
subgraph cluster_14 {
color=blue color=blue
64 [label="Enter when branch condition "]; 64 [label="Enter when branch condition "];
65 [label="Access variable R|<local>/cause|"]; 65 [label="Access variable this@R|/closeFinally|"];
66 [label="Const: Null(null)"]; 66 [label="Const: Null(null)"];
67 [label="Operator =="]; 67 [label="Operator =="];
68 [label="Exit when branch condition"]; 68 [label="Exit when branch condition"];
} }
subgraph cluster_14 {
color=blue
69 [label="Enter when branch condition "];
70 [label="Access variable R|<local>/cause|"];
71 [label="Const: Null(null)"];
72 [label="Operator =="];
73 [label="Exit when branch condition"];
}
subgraph cluster_15 { subgraph cluster_15 {
color=blue color=blue
69 [label="Enter when branch condition else"]; 74 [label="Enter when branch condition else"];
70 [label="Exit when branch condition"]; 75 [label="Exit when branch condition"];
} }
71 [label="Enter when branch result"]; 76 [label="Enter when branch result"];
subgraph cluster_16 { subgraph cluster_16 {
color=blue color=blue
72 [label="Enter block"]; 77 [label="Enter block"];
subgraph cluster_17 { subgraph cluster_17 {
color=blue color=blue
73 [label="Try expression enter"]; 78 [label="Try expression enter"];
subgraph cluster_18 { subgraph cluster_18 {
color=blue color=blue
74 [label="Try main block enter"]; 79 [label="Try main block enter"];
subgraph cluster_19 { subgraph cluster_19 {
color=blue color=blue
75 [label="Enter block"]; 80 [label="Enter block"];
76 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"]; 81 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"];
77 [label="Exit block"]; 82 [label="Exit block"];
} }
78 [label="Try main block exit"]; 83 [label="Try main block exit"];
} }
subgraph cluster_20 { subgraph cluster_20 {
color=blue color=blue
79 [label="Catch enter"]; 84 [label="Catch enter"];
subgraph cluster_21 { subgraph cluster_21 {
color=blue color=blue
80 [label="Enter block"]; 85 [label="Enter block"];
81 [label="Access variable R|<local>/cause|"]; 86 [label="Access variable R|<local>/cause|"];
82 [label="Access variable R|<local>/closeException|"]; 87 [label="Access variable R|<local>/closeException|"];
83 [label="Function call: R|<local>/cause|.R|kotlin/addSuppressed|(R|<local>/closeException|)"]; 88 [label="Function call: R|<local>/cause|.R|kotlin/addSuppressed|(R|<local>/closeException|)"];
84 [label="Exit block"]; 89 [label="Exit block"];
} }
85 [label="Catch exit"]; 90 [label="Catch exit"];
} }
86 [label="Try expression exit"]; 91 [label="Try expression exit"];
} }
87 [label="Exit block"];
}
88 [label="Exit when branch result"];
89 [label="Enter when branch result"];
subgraph cluster_22 {
color=blue
90 [label="Enter block"];
91 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"];
92 [label="Exit block"]; 92 [label="Exit block"];
} }
93 [label="Exit when branch result"]; 93 [label="Exit when branch result"];
94 [label="Enter when branch result"]; 94 [label="Enter when branch result"];
subgraph cluster_23 { subgraph cluster_22 {
color=blue color=blue
95 [label="Enter block"]; 95 [label="Enter block"];
96 [label="Exit block"]; 96 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"];
97 [label="Exit block"];
} }
97 [label="Exit when branch result"]; 98 [label="Exit when branch result"];
98 [label="Exit when"]; 99 [label="Enter when branch result"];
subgraph cluster_23 {
color=blue
100 [label="Enter block"];
101 [label="Exit block"];
}
102 [label="Exit when branch result"];
103 [label="Exit when"];
} }
99 [label="Jump: ^closeFinally when () { 104 [label="Jump: ^closeFinally when () {
==(this@R|/closeFinally|, Null(null)) -> { ==(this@R|/closeFinally|, Null(null)) -> {
} }
==(R|<local>/cause|, Null(null)) -> { ==(R|<local>/cause|, Null(null)) -> {
@@ -255,155 +265,155 @@ digraph complex_kt {
} }
} }
"]; "];
100 [label="Stub" style="filled" fillcolor=gray]; 105 [label="Stub" style="filled" fillcolor=gray];
101 [label="Exit function closeFinally" style="filled" fillcolor=red]; 106 [label="Exit function closeFinally" style="filled" fillcolor=red];
} }
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63}; 62 -> {63};
63 -> {94 64}; 63 -> {64};
64 -> {65}; 64 -> {65};
65 -> {66}; 65 -> {66};
66 -> {67}; 66 -> {67};
67 -> {68}; 67 -> {68};
68 -> {89 69}; 68 -> {99 69};
69 -> {70}; 69 -> {70};
70 -> {71}; 70 -> {71};
71 -> {72}; 71 -> {72};
72 -> {73}; 72 -> {73};
73 -> {74}; 73 -> {94 74};
74 -> {101 79 75}; 74 -> {75};
75 -> {76}; 75 -> {76};
76 -> {77}; 76 -> {77};
77 -> {78}; 77 -> {78};
78 -> {86}; 78 -> {79};
79 -> {101 80}; 79 -> {106 84 80};
80 -> {81}; 80 -> {81};
81 -> {82}; 81 -> {82};
82 -> {83}; 82 -> {83};
83 -> {84}; 83 -> {91};
84 -> {85}; 84 -> {106 85};
85 -> {86}; 85 -> {86};
86 -> {87}; 86 -> {87};
87 -> {88}; 87 -> {88};
88 -> {98}; 88 -> {89};
89 -> {90}; 89 -> {90};
90 -> {91}; 90 -> {91};
91 -> {92}; 91 -> {92};
92 -> {93}; 92 -> {93};
93 -> {98}; 93 -> {103};
94 -> {95}; 94 -> {95};
95 -> {96}; 95 -> {96};
96 -> {97}; 96 -> {97};
97 -> {98}; 97 -> {98};
98 -> {99}; 98 -> {103};
99 -> {101}; 99 -> {100};
99 -> {100} [style=dotted]; 100 -> {101};
100 -> {101} [style=dotted]; 101 -> {102};
102 -> {103};
103 -> {104};
104 -> {106};
104 -> {105} [style=dotted];
105 -> {106} [style=dotted];
subgraph cluster_24 { subgraph cluster_24 {
color=red color=red
102 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red]; 107 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red];
103 [label="Access variable this@R|/firstIsInstanceOrNull|"]; 108 [label="Access variable this@R|/firstIsInstanceOrNull|"];
104 [label="Variable declaration: lval <range>: R|kotlin/sequences/Sequence<*>|"]; 109 [label="Variable declaration: lval <range>: R|kotlin/sequences/Sequence<*>|"];
105 [label="Access variable R|<local>/<range>|"]; 110 [label="Access variable R|<local>/<range>|"];
106 [label="Function call: R|<local>/<range>|.R|kotlin/sequences/Sequence.iterator|()"]; 111 [label="Function call: R|<local>/<range>|.R|kotlin/sequences/Sequence.iterator|()"];
107 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<T>|"]; 112 [label="Variable declaration: lval <iterator>: R|kotlin/collections/Iterator<T>|"];
subgraph cluster_25 { subgraph cluster_25 {
color=blue color=blue
108 [label="Enter while loop"]; 113 [label="Enter while loop"];
subgraph cluster_26 { subgraph cluster_26 {
color=blue color=blue
109 [label="Enter loop condition"]; 114 [label="Enter loop condition"];
110 [label="Access variable R|<local>/<iterator>|"]; 115 [label="Access variable R|<local>/<iterator>|"];
111 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"]; 116 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()"];
112 [label="Exit loop condition"]; 117 [label="Exit loop condition"];
} }
subgraph cluster_27 { subgraph cluster_27 {
color=blue color=blue
113 [label="Enter loop block"]; 118 [label="Enter loop block"];
subgraph cluster_28 { subgraph cluster_28 {
color=blue color=blue
114 [label="Enter block"]; 119 [label="Enter block"];
115 [label="Access variable R|<local>/<iterator>|"]; 120 [label="Access variable R|<local>/<iterator>|"];
116 [label="Function call: R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|T|>|()"]; 121 [label="Function call: R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|T|>|()"];
117 [label="Variable declaration: lval element: R|T|"]; 122 [label="Variable declaration: lval element: R|T|"];
subgraph cluster_29 { subgraph cluster_29 {
color=blue color=blue
118 [label="Enter when"]; 123 [label="Enter when"];
subgraph cluster_30 { subgraph cluster_30 {
color=blue color=blue
119 [label="Enter when branch condition "]; 124 [label="Enter when branch condition "];
120 [label="Access variable R|<local>/element|"]; 125 [label="Access variable R|<local>/element|"];
121 [label="Type operator: element is T"]; 126 [label="Type operator: element is T"];
122 [label="Exit when branch condition"]; 127 [label="Exit when branch condition"];
} }
123 [label="Synthetic else branch"]; 128 [label="Synthetic else branch"];
124 [label="Enter when branch result"]; 129 [label="Enter when branch result"];
subgraph cluster_31 { subgraph cluster_31 {
color=blue color=blue
125 [label="Enter block"]; 130 [label="Enter block"];
126 [label="Access variable R|<local>/element|"]; 131 [label="Access variable R|<local>/element|"];
127 [label="Jump: ^firstIsInstanceOrNull R|<local>/element|"]; 132 [label="Jump: ^firstIsInstanceOrNull R|<local>/element|"];
128 [label="Stub" style="filled" fillcolor=gray]; 133 [label="Stub" style="filled" fillcolor=gray];
129 [label="Exit block" style="filled" fillcolor=gray]; 134 [label="Exit block" style="filled" fillcolor=gray];
} }
130 [label="Exit when branch result" style="filled" fillcolor=gray]; 135 [label="Exit when branch result" style="filled" fillcolor=gray];
131 [label="Exit when"]; 136 [label="Exit when"];
} }
132 [label="Exit block"]; 137 [label="Exit block"];
} }
133 [label="Exit loop block"]; 138 [label="Exit loop block"];
} }
134 [label="Exit whileloop"]; 139 [label="Exit whileloop"];
} }
135 [label="Const: Null(null)"]; 140 [label="Const: Null(null)"];
136 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; 141 [label="Jump: ^firstIsInstanceOrNull Null(null)"];
137 [label="Stub" style="filled" fillcolor=gray]; 142 [label="Stub" style="filled" fillcolor=gray];
138 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; 143 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red];
} }
102 -> {103};
103 -> {104};
104 -> {105};
105 -> {106};
106 -> {107};
107 -> {108}; 107 -> {108};
108 -> {109}; 108 -> {109};
109 -> {110}; 109 -> {110};
110 -> {111}; 110 -> {111};
111 -> {112}; 111 -> {112};
112 -> {134 113}; 112 -> {113};
113 -> {114}; 113 -> {114};
114 -> {115}; 114 -> {115};
115 -> {116}; 115 -> {116};
116 -> {117}; 116 -> {117};
117 -> {118}; 117 -> {139 118};
118 -> {119}; 118 -> {119};
119 -> {120}; 119 -> {120};
120 -> {121}; 120 -> {121};
121 -> {122}; 121 -> {122};
122 -> {124 123}; 122 -> {123};
123 -> {131}; 123 -> {124};
124 -> {125}; 124 -> {125};
125 -> {126}; 125 -> {126};
126 -> {127}; 126 -> {127};
127 -> {138}; 127 -> {129 128};
127 -> {128} [style=dotted]; 128 -> {136};
128 -> {129} [style=dotted]; 129 -> {130};
129 -> {130} [style=dotted]; 130 -> {131};
130 -> {131} [style=dotted];
131 -> {132}; 131 -> {132};
132 -> {133}; 132 -> {143};
133 -> {109}; 132 -> {133} [style=dotted];
134 -> {135}; 133 -> {134} [style=dotted];
135 -> {136}; 134 -> {135} [style=dotted];
136 -> {138}; 135 -> {136} [style=dotted];
136 -> {137} [style=dotted]; 136 -> {137};
137 -> {138} [style=dotted]; 137 -> {138};
138 -> {114};
139 -> {140};
140 -> {141};
141 -> {143};
141 -> {142} [style=dotted];
142 -> {143} [style=dotted];
} }
+1 -1
View File
@@ -2,7 +2,7 @@ FILE: complex.kt
@R|kotlin/jvm/Throws|(<getClass>(<Unresolved name: IOException>#), <getClass>(<Unresolved name: ResponseParseException>#)) public final fun fetchPluginReleaseDate(pluginId: R|class error: Symbol not found, for `PluginId`|, version: R|kotlin/String|, channel: R|kotlin/String?|): R|class error: Symbol not found, for `LocalDate?`| { @R|kotlin/jvm/Throws|(<getClass>(<Unresolved name: IOException>#), <getClass>(<Unresolved name: ResponseParseException>#)) public final fun fetchPluginReleaseDate(pluginId: R|class error: Symbol not found, for `PluginId`|, version: R|kotlin/String|, channel: R|kotlin/String?|): R|class error: Symbol not found, for `LocalDate?`| {
lval url: R|kotlin/String| = <strcat>(String(https://plugins.jetbrains.com/api/plugins/), R|<local>/pluginId|.<Unresolved name: idString>#, String(/updates?version=), R|<local>/version|) lval url: R|kotlin/String| = <strcat>(String(https://plugins.jetbrains.com/api/plugins/), R|<local>/pluginId|.<Unresolved name: idString>#, String(/updates?version=), R|<local>/version|)
lval pluginDTOs: R|kotlin/Array<class error: Symbol not found, for `PluginDTO`>| = try { lval pluginDTOs: R|kotlin/Array<class error: Symbol not found, for `PluginDTO`>| = try {
<Unresolved name: HttpRequests>#.<Unresolved name: request>#(R|<local>/url|).<Unresolved name: connect>#(<L> = connect@fun <implicit>.<anonymous>(): <ERROR TYPE REF: Unresolved name: fromJson> { <Unresolved name: HttpRequests>#.<Unresolved name: request>#(R|<local>/url|).<Unresolved name: connect>#(<L> = connect@fun <anonymous>(): <ERROR TYPE REF: Unresolved name: fromJson> {
<Unresolved name: GsonBuilder>#().<Unresolved name: create>#().<Unresolved name: fromJson>#(<Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#(), <getClass>(<Inapplicable(PARAMETER_MAPPING_ERROR): [kotlin/Array.Array]>#<R|class error: Symbol not found, for `PluginDTO`|>()).<Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#) <Unresolved name: GsonBuilder>#().<Unresolved name: create>#().<Unresolved name: fromJson>#(<Unresolved name: it>#.<Unresolved name: inputStream>#.<Ambiguity: reader, [kotlin/io/reader, kotlin/io/reader, kotlin/io/reader]>#(), <getClass>(<Inapplicable(PARAMETER_MAPPING_ERROR): [kotlin/Array.Array]>#<R|class error: Symbol not found, for `PluginDTO`|>()).<Inapplicable(WRONG_RECEIVER): [kotlin/jvm/java]>#)
} }
) )
@@ -14,7 +14,7 @@ FILE: main.kt
R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|() R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
} }
)) ))
<Inapplicable(INAPPLICABLE): [/foo2]>#(R?C|/MyFunction|(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| { <Inapplicable(INAPPLICABLE): [/foo2]>#(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String>|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
R|<local>/x|.R|kotlin/Any.toString|() R|<local>/x|.R|kotlin/Any.toString|()
} }
)) ))
@@ -8,7 +8,7 @@ FILE: main.kt
R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|() R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
} }
) )
Q|JavaUsage|.<Inapplicable(INAPPLICABLE): [/JavaUsage.foo2]>#(<L> = foo2@fun <implicit>.<anonymous>(x: R|kotlin/Int|): R|kotlin/String| { Q|JavaUsage|.<Inapplicable(INAPPLICABLE): [/JavaUsage.foo2]>#(<L> = foo2@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
R|<local>/x|.R|kotlin/Any.toString|() R|<local>/x|.R|kotlin/Any.toString|()
} }
) )
@@ -38,12 +38,12 @@ FILE: kotlinSam.kt
} }
) )
R|/foo1|(R|<local>/f|) R|/foo1|(R|<local>/f|)
<Inapplicable(INAPPLICABLE): [/foo2]>#(<L> = foo2@fun <implicit>.<anonymous>(x: <ERROR TYPE REF: Unsupported: implicit VP type>): R|kotlin/Boolean| { <Inapplicable(INAPPLICABLE): [/foo2]>#(<L> = foo2@fun <anonymous>(x: R|class error: No type for parameter|): R|kotlin/Boolean| {
>(R|<local>/x|, Int(1)) >(R|<local>/x|, Int(1))
} }
) )
<Inapplicable(INAPPLICABLE): [/foo2]>#(R|<local>/f|) <Inapplicable(INAPPLICABLE): [/foo2]>#(R|<local>/f|)
<Inapplicable(INAPPLICABLE): [/foo3]>#(<L> = foo3@fun <implicit>.<anonymous>(x: <ERROR TYPE REF: Unsupported: implicit VP type>): R|kotlin/Boolean| { <Inapplicable(INAPPLICABLE): [/foo3]>#(<L> = foo3@fun <anonymous>(x: R|class error: No type for parameter|): R|kotlin/Boolean| {
>(R|<local>/x|, Int(1)) >(R|<local>/x|, Int(1))
} }
) )
@@ -2,11 +2,11 @@ FILE: main.kt
public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| { public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| {
} }
public final fun main(): R|kotlin/Unit| { public final fun main(): R|kotlin/Unit| {
Q|JavaUsage|.<Inapplicable(INAPPLICABLE): [/JavaUsage.foo]>#(<L> = foo@fun <implicit>.<anonymous>(x: <ERROR TYPE REF: Unsupported: implicit VP type>): R|kotlin/Boolean| { Q|JavaUsage|.<Inapplicable(INAPPLICABLE): [/JavaUsage.foo]>#(<L> = foo@fun <anonymous>(x: R|class error: No type for parameter|): R|kotlin/Boolean| {
>(R|<local>/x|, Int(1)) >(R|<local>/x|, Int(1))
} }
) )
Q|JavaUsage|.<Inapplicable(INAPPLICABLE): [/JavaUsage.foo]>#(foo@fun <implicit>.<anonymous>(): R|kotlin/Boolean| { Q|JavaUsage|.<Inapplicable(INAPPLICABLE): [/JavaUsage.foo]>#(foo@fun <anonymous>(): R|kotlin/Boolean| {
>(<Unresolved name: it>#, Int(1)) >(<Unresolved name: it>#, Int(1))
} }
) )
@@ -6,5 +6,5 @@ fun bar(): Int = 1
fun bar(x: String): Int = 1 fun bar(x: String): Int = 1
fun main() { fun main() {
<!AMBIGUITY!>foo<!>(::bar) <!AMBIGUITY!>foo<!>(<!UNRESOLVED_REFERENCE!>::bar<!>)
} }
@@ -10,5 +10,5 @@ FILE: manyInnermanyOuterCandidatesAmbiguity.kt
^bar Int(1) ^bar Int(1)
} }
public final fun main(): R|kotlin/Unit| { public final fun main(): R|kotlin/Unit| {
<Ambiguity: foo, [/foo, /foo]>#(::bar#) <Ambiguity: foo, [/foo, /foo]>#(::<Unresolved reference: bar>#)
} }
+2 -2
View File
@@ -6,7 +6,7 @@ FILE: test.kt
) )
lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value)) lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value))
lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value)) lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value))
R|<local>/map|.<Inapplicable(INAPPLICABLE): [kotlin/collections/forEach]>#(<L> = forEach@fun <implicit>.<anonymous>(key: <ERROR TYPE REF: Unsupported: implicit VP type>, value: <ERROR TYPE REF: Unsupported: implicit VP type>): R|kotlin/Unit| { R|<local>/map|.<Inapplicable(INAPPLICABLE): [kotlin/collections/forEach]>#(<L> = forEach@fun <anonymous>(key: R|class error: No type for parameter|, value: R|class error: No type for parameter|): R|kotlin/Unit| {
R|kotlin/io/println|(<strcat>(R|<local>/key|, String(: ), R|<local>/value|)) R|kotlin/io/println|(<strcat>(R|<local>/key|, String(: ), R|<local>/value|))
} }
) )
@@ -24,7 +24,7 @@ FILE: test.kt
) )
lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value)) lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value))
lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value)) lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value))
R|<local>/map|.<Inapplicable(INAPPLICABLE): [kotlin/collections/forEach]>#(<L> = forEach@fun <implicit>.<anonymous>(key: <ERROR TYPE REF: Unsupported: implicit VP type>, value: <ERROR TYPE REF: Unsupported: implicit VP type>): R|kotlin/Unit| { R|<local>/map|.<Inapplicable(INAPPLICABLE): [kotlin/collections/forEach]>#(<L> = forEach@fun <anonymous>(key: R|class error: No type for parameter|, value: R|class error: No type for parameter|): R|kotlin/Unit| {
R|kotlin/io/println|(<strcat>(R|<local>/key|, String(: ), R|<local>/value|)) R|kotlin/io/println|(<strcat>(R|<local>/key|, String(: ), R|<local>/value|))
} }
) )
@@ -270,6 +270,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/arguments/lambdaInLambda2.kt"); runTest("compiler/fir/resolve/testData/resolve/arguments/lambdaInLambda2.kt");
} }
@TestMetadata("lambdaInUnresolvedCall.kt")
public void testLambdaInUnresolvedCall() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/arguments/lambdaInUnresolvedCall.kt");
}
@TestMetadata("overloadByReceiver.kt") @TestMetadata("overloadByReceiver.kt")
public void testOverloadByReceiver() throws Exception { public void testOverloadByReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/arguments/overloadByReceiver.kt"); runTest("compiler/fir/resolve/testData/resolve/arguments/overloadByReceiver.kt");
@@ -2,7 +2,7 @@ FILE fqName:<root> fileName:/samByProjectedType.kt
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY BLOCK_BODY
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/H.bar]>#' type=IrErrorType ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/H.bar]>#' type=IrErrorType
FUN_EXPR type=IrErrorType origin=LAMBDA FUN_EXPR type=kotlin.Function1<kotlin.Any, kotlin.Any> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Any FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Any
VALUE_PARAMETER name:x index:0 type:kotlin.Any VALUE_PARAMETER name:x index:0 type:kotlin.Any
BLOCK_BODY BLOCK_BODY
@@ -24,7 +24,7 @@ FILE fqName:<root> fileName:/samConstructors.kt
BLOCK_BODY BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test4 (): IrErrorType declared in <root>' RETURN type=kotlin.Nothing from='public final fun test4 (): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Unresolved name: Comparator>#' type=IrErrorType ERROR_CALL 'Unresolved reference: <Unresolved name: Comparator>#' type=IrErrorType
FUN_EXPR type=IrErrorType origin=LAMBDA FUN_EXPR type=kotlin.Function2<IrErrorType, IrErrorType, IrErrorType> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (a:IrErrorType, b:IrErrorType) returnType:IrErrorType FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (a:IrErrorType, b:IrErrorType) returnType:IrErrorType
VALUE_PARAMETER name:a index:0 type:IrErrorType VALUE_PARAMETER name:a index:0 type:IrErrorType
VALUE_PARAMETER name:b index:1 type:IrErrorType VALUE_PARAMETER name:b index:1 type:IrErrorType