[FIR] Support deserialization of value parameter annotations

There are still some problems, see KT-39837
This commit is contained in:
Dmitriy Novozhilov
2020-06-25 18:26:01 +03:00
parent 2b2f9b3386
commit 7834284bec
22 changed files with 191 additions and 96 deletions
@@ -29,115 +29,110 @@ digraph complexPostponedCfg_kt {
9 [label="Postponed enter to lambda"];
subgraph cluster_4 {
color=blue
21 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
19 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
22 [label="Enter block"];
23 [label="Postponed enter to lambda"];
20 [label="Enter block"];
21 [label="Postponed enter to lambda"];
subgraph cluster_6 {
color=blue
28 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
26 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
29 [label="Enter block"];
30 [label="Access variable this@R|special/anonymous|"];
31 [label="Function call: this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(...)"];
32 [label="Access variable R|<local>/arguments|"];
33 [label="Function call: R|<local>/arguments|.R|kotlin/collections/last|<R|FirBase|>()"];
34 [label="Type operator: (R|<local>/arguments|.R|kotlin/collections/last|<R|FirBase|>() as R|FirFunctionCall|)"];
35 [label="Postponed enter to lambda"];
27 [label="Enter block"];
28 [label="Access variable this@R|special/anonymous|"];
29 [label="Function call: this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(...)"];
30 [label="Access variable R|<local>/arguments|"];
31 [label="Function call: R|<local>/arguments|.R|kotlin/collections/last|<R|FirBase|>()"];
32 [label="Type operator: (R|<local>/arguments|.R|kotlin/collections/last|<R|FirBase|>() as R|FirFunctionCall|)"];
33 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
41 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
39 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
42 [label="Enter block"];
43 [label="Access variable this@R|special/anonymous|"];
44 [label="Function call: this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(...)"];
45 [label="Access variable R|<local>/explicitReceiver|"];
46 [label="Type operator: (R|<local>/explicitReceiver| as R|FirFunctionCall|)"];
47 [label="Function call: this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(...)"];
48 [label="Exit block"];
40 [label="Enter block"];
41 [label="Access variable this@R|special/anonymous|"];
42 [label="Function call: this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(...)"];
43 [label="Access variable R|<local>/explicitReceiver|"];
44 [label="Type operator: (R|<local>/explicitReceiver| as R|FirFunctionCall|)"];
45 [label="Function call: this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(...)"];
46 [label="Exit block"];
}
49 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
47 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
36 [label="Call arguments union" style="filled" fillcolor=yellow];
37 [label="Postponed exit from lambda"];
38 [label="Function call: R|kotlin/with|<R|FirFunctionCall|, R|kotlin/Boolean|>(...)"];
39 [label="Exit block"];
34 [label="Call arguments union" style="filled" fillcolor=yellow];
35 [label="Postponed exit from lambda"];
36 [label="Function call: R|kotlin/with|<R|FirFunctionCall|, R|kotlin/Boolean|>(...)"];
37 [label="Exit block"];
}
40 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
38 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
24 [label="Postponed exit from lambda"];
25 [label="Function call: R|kotlin/collections/buildList|<R|kotlin/Any?|>(...)"];
26 [label="Exit block"];
22 [label="Postponed exit from lambda"];
23 [label="Function call: R|kotlin/collections/buildList|<R|FirFunctionCall|>(...)"];
24 [label="Exit block"];
}
27 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
25 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
10 [label="Call arguments union" style="filled" fillcolor=yellow];
11 [label="Postponed exit from lambda"];
12 [label="Function call: R|kotlin/with|<R|FirFunctionCall|, R|kotlin/Nothing|>(...)"];
13 [label="Stub" style="filled" fillcolor=gray];
14 [label="Variable declaration: lval firstCalls: R|kotlin/Nothing|" style="filled" fillcolor=gray];
15 [label="Access variable R|<local>/firstCalls|" style="filled" fillcolor=gray];
12 [label="Function call: R|kotlin/with|<R|FirFunctionCall|, R|kotlin/collections/List<FirFunctionCall>|>(...)"];
13 [label="Variable declaration: lval firstCalls: R|kotlin/collections/List<FirFunctionCall>|"];
14 [label="Access variable R|<local>/firstCalls|"];
15 [label="Jump: ^foo R|<local>/firstCalls|"];
16 [label="Stub" style="filled" fillcolor=gray];
17 [label="Jump: ^foo R|<local>/firstCalls|" style="filled" fillcolor=gray];
18 [label="Stub" style="filled" fillcolor=gray];
19 [label="Exit block" style="filled" fillcolor=gray];
17 [label="Exit block" style="filled" fillcolor=gray];
}
20 [label="Exit function foo" style="filled" fillcolor=red];
18 [label="Exit function foo" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {21};
9 -> {19};
9 -> {11} [color=red];
10 -> {12} [color=red];
11 -> {12} [color=green];
12 -> {20};
12 -> {13} [style=dotted];
13 -> {14} [style=dotted];
14 -> {15} [style=dotted];
15 -> {20 16} [style=dotted];
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {18};
15 -> {16} [style=dotted];
16 -> {17} [style=dotted];
17 -> {20 18} [style=dotted];
18 -> {19} [style=dotted];
19 -> {20} [style=dotted];
21 -> {22};
17 -> {18} [style=dotted];
19 -> {20};
20 -> {21};
21 -> {26};
21 -> {22} [color=red];
22 -> {23};
23 -> {28};
23 -> {24} [color=red];
23 -> {24};
24 -> {25};
25 -> {26};
25 -> {10} [color=red];
25 -> {11} [color=green];
26 -> {27};
27 -> {10} [color=red];
27 -> {11} [color=green];
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {41};
35 -> {37} [color=red];
36 -> {38} [color=red];
37 -> {38} [color=green];
38 -> {39};
33 -> {39};
33 -> {35} [color=red];
34 -> {36} [color=red];
35 -> {36} [color=green];
36 -> {37};
37 -> {38};
38 -> {22} [color=green];
39 -> {40};
40 -> {10} [color=red];
40 -> {24} [color=green];
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {36} [color=red];
49 -> {37} [color=green];
47 -> {34} [color=red];
47 -> {35} [color=green];
}
@@ -4,8 +4,8 @@ FILE: complexPostponedCfg.kt
public abstract interface FirFunctionCall : R|FirBase| {
}
public final fun foo(statements: R|kotlin/collections/List<FirBase>|, arguments: R|kotlin/collections/List<FirBase>|, explicitReceiver: R|FirBase|): R|kotlin/collections/List<FirFunctionCall>| {
lval firstCalls: R|kotlin/Nothing| = R|kotlin/with|<R|FirFunctionCall|, R|kotlin/Nothing|>((R|<local>/statements|.R|kotlin/collections/last|<R|FirBase|>() as R|FirFunctionCall|), <L> = setCall@fun R|FirFunctionCall|.<anonymous>(): R|kotlin/Nothing| <kind=EXACTLY_ONCE> {
^ R|kotlin/collections/buildList|<R|kotlin/Any?|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/Any?>|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
lval firstCalls: R|kotlin/collections/List<FirFunctionCall>| = R|kotlin/with|<R|FirFunctionCall|, R|kotlin/collections/List<FirFunctionCall>|>((R|<local>/statements|.R|kotlin/collections/last|<R|FirBase|>() as R|FirFunctionCall|), <L> = setCall@fun R|FirFunctionCall|.<anonymous>(): R|kotlin/collections/List<FirFunctionCall>| <kind=EXACTLY_ONCE> {
^ R|kotlin/collections/buildList|<R|FirFunctionCall|>(<L> = buildList@fun R|kotlin/collections/MutableList<FirFunctionCall>|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(this@R|special/anonymous|)
^ R|kotlin/with|<R|FirFunctionCall|, R|kotlin/Boolean|>((R|<local>/arguments|.R|kotlin/collections/last|<R|FirBase|>() as R|FirFunctionCall|), <L> = plusCall@fun R|FirFunctionCall|.<anonymous>(): R|kotlin/Boolean| <kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(this@R|special/anonymous|)
@@ -0,0 +1,19 @@
fun test_1() {
val list = buildList {
add("")
}
takeList(list)
}
fun test_2() {
val list = myBuildList {
add("")
}
takeList(list)
}
fun <E> myBuildList(@BuilderInference builderAction: MutableList<E>.() -> Unit): List<E> {
return ArrayList<E>().apply(builderAction)
}
fun takeList(list: List<String>) {}
@@ -0,0 +1,20 @@
FILE: builderInferenceFromStdlib.kt
public final fun test_1(): R|kotlin/Unit| {
lval list: R|kotlin/collections/List<kotlin/String>| = R|kotlin/collections/buildList|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
^ this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String())
}
)
R|/takeList|(R|<local>/list|)
}
public final fun test_2(): R|kotlin/Unit| {
lval list: R|kotlin/collections/List<kotlin/String>| = R|/myBuildList|<R|kotlin/String|>(<L> = myBuildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| {
^ this@R|special/anonymous|.R|FakeOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String())
}
)
R|/takeList|(R|<local>/list|)
}
public final fun <E> myBuildList(@R|kotlin/BuilderInference|() builderAction: R|kotlin/collections/MutableList<E>.() -> kotlin/Unit|): R|kotlin/collections/List<E>| {
^myBuildList R|java/util/ArrayList.ArrayList|<R|E|>().R|kotlin/apply|<R|java/util/ArrayList<E>|>(R|<local>/builderAction|)
}
public final fun takeList(list: R|kotlin/collections/List<kotlin/String>|): R|kotlin/Unit| {
}