[FE] Preserve legacy contract description calls in bodies

^KT-55231 Fixed
^KTIJ-21012 Fixed
This commit is contained in:
Yan Zhulanow
2022-12-02 17:44:31 +09:00
committed by Space Team
parent f067f64255
commit d652dc620c
103 changed files with 4258 additions and 3201 deletions
@@ -9,100 +9,107 @@ digraph inAnonymousObject_kt {
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Enter anonymous object"];
subgraph cluster_2 {
color=blue
11 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
12 [label="Part of class initialization"];
13 [label="Part of class initialization"];
14 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
2 [label="Enter block"];
3 [label="Exit block"];
}
3 [label="Exit anonymous object"];
4 [label="Exit anonymous object expression"];
5 [label="Variable declaration: lval obj: R|<anonymous>|"];
6 [label="Access variable R|<local>/obj|"];
7 [label="Function call: R|<local>/obj|.R|/<anonymous>.run|()" style="filled" fillcolor=yellow];
8 [label="Function call: R|<local>/d|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
9 [label="Exit block"];
4 [label="Enter anonymous object"];
subgraph cluster_3 {
color=blue
13 [label="Enter class <anonymous object>" style="filled" fillcolor=red];
14 [label="Part of class initialization"];
15 [label="Part of class initialization"];
16 [label="Exit class <anonymous object>" style="filled" fillcolor=red];
}
5 [label="Exit anonymous object"];
6 [label="Exit anonymous object expression"];
7 [label="Variable declaration: lval obj: R|<anonymous>|"];
8 [label="Access variable R|<local>/obj|"];
9 [label="Function call: R|<local>/obj|.R|/<anonymous>.run|()" style="filled" fillcolor=yellow];
10 [label="Function call: R|<local>/d|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
11 [label="Exit block"];
}
10 [label="Exit function foo" style="filled" fillcolor=red];
12 [label="Exit function foo" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
1 -> {15 18 21 27} [color=red];
2 -> {3} [color=red];
2 -> {11} [color=green];
2 -> {11} [style=dashed];
2 -> {3};
3 -> {4};
3 -> {15 27} [color=green];
3 -> {15 27} [style=dashed];
4 -> {5};
3 -> {37 40 43 49} [color=red];
4 -> {5} [color=red];
4 -> {13} [color=green];
4 -> {13} [style=dashed];
5 -> {6};
5 -> {37 49} [color=green];
5 -> {37 49} [style=dashed];
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
11 -> {12} [color=green];
12 -> {13} [style=dotted];
12 -> {18} [color=green];
12 -> {18} [style=dashed];
13 -> {14} [style=dotted];
13 -> {21} [color=green];
13 -> {21} [style=dashed];
14 -> {3} [color=green];
subgraph cluster_3 {
color=red
15 [label="Enter function <init>" style="filled" fillcolor=red];
16 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
17 [label="Exit function <init>" style="filled" fillcolor=red];
}
15 -> {16};
16 -> {17};
10 -> {11};
11 -> {12};
13 -> {14} [color=green];
14 -> {15} [style=dotted];
14 -> {40} [color=green];
14 -> {40} [style=dashed];
15 -> {16} [style=dotted];
15 -> {43} [color=green];
15 -> {43} [style=dashed];
16 -> {5} [color=green];
subgraph cluster_4 {
color=red
18 [label="Enter property" style="filled" fillcolor=red];
19 [label="Access variable R|<local>/a|"];
20 [label="Exit property" style="filled" fillcolor=red];
37 [label="Enter function <init>" style="filled" fillcolor=red];
38 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
39 [label="Exit function <init>" style="filled" fillcolor=red];
}
18 -> {19};
19 -> {20};
20 -> {13} [color=green];
37 -> {38};
38 -> {39};
subgraph cluster_5 {
color=red
21 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
22 [label="Enter block"];
23 [label="Access variable R|<local>/b|"];
24 [label="Assignment: R|/<anonymous>.leaked|"];
25 [label="Exit block"];
}
26 [label="Exit init block" style="filled" fillcolor=red];
40 [label="Enter property" style="filled" fillcolor=red];
41 [label="Access variable R|<local>/a|"];
42 [label="Exit property" style="filled" fillcolor=red];
}
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {14} [color=green];
40 -> {41};
41 -> {42};
42 -> {15} [color=green];
subgraph cluster_7 {
subgraph cluster_6 {
color=red
27 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_8 {
43 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
28 [label="Enter block"];
29 [label="Function call: R|<local>/c|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
30 [label="Exit block"];
44 [label="Enter block"];
45 [label="Access variable R|<local>/b|"];
46 [label="Assignment: R|/<anonymous>.leaked|"];
47 [label="Exit block"];
}
31 [label="Exit function run" style="filled" fillcolor=red];
48 [label="Exit init block" style="filled" fillcolor=red];
}
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {16} [color=green];
subgraph cluster_8 {
color=red
49 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
50 [label="Enter block"];
51 [label="Function call: R|<local>/c|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
52 [label="Exit block"];
}
53 [label="Exit function run" style="filled" fillcolor=red];
}
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {53};
}
@@ -8,7 +8,16 @@ FILE: inAnonymousObject.kt
CallsInPlace(d, AT_MOST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/a|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/b|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/c|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/d|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
}
)
}
lval obj: R|<anonymous>| = object : R|java/lang/Runnable| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
@@ -9,100 +9,107 @@ digraph inLocalClass_kt {
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Exit local class foo"];
3 [label="Function call: R|/LocalClass.LocalClass|()" style="filled" fillcolor=yellow];
4 [label="Function call: R|/LocalClass.LocalClass|().R|<local>/run|()" style="filled" fillcolor=yellow];
5 [label="Function call: R|<local>/e|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
6 [label="Exit block"];
subgraph cluster_2 {
color=blue
2 [label="Enter block"];
3 [label="Exit block"];
}
4 [label="Exit local class foo"];
5 [label="Function call: R|/LocalClass.LocalClass|()" style="filled" fillcolor=yellow];
6 [label="Function call: R|/LocalClass.LocalClass|().R|<local>/run|()" style="filled" fillcolor=yellow];
7 [label="Function call: R|<local>/e|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
8 [label="Exit block"];
}
7 [label="Exit function foo" style="filled" fillcolor=red];
9 [label="Exit function foo" style="filled" fillcolor=red];
}
subgraph cluster_2 {
subgraph cluster_3 {
color=blue
8 [label="Enter class LocalClass" style="filled" fillcolor=red];
9 [label="Part of class initialization"];
10 [label="Part of class initialization"];
11 [label="Exit class LocalClass" style="filled" fillcolor=red];
10 [label="Enter class LocalClass" style="filled" fillcolor=red];
11 [label="Part of class initialization"];
12 [label="Part of class initialization"];
13 [label="Exit class LocalClass" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
1 -> {12 15 21 27} [color=red];
2 -> {3};
2 -> {15 27 8} [color=green];
2 -> {15 27 8} [style=dashed];
3 -> {4};
3 -> {38 41 47 53} [color=red];
4 -> {5};
4 -> {41 53 10} [color=green];
4 -> {41 53 10} [style=dashed];
5 -> {6};
6 -> {7};
8 -> {9} [color=green];
9 -> {10} [style=dotted];
9 -> {12} [color=green];
9 -> {12} [style=dashed];
10 -> {11} [style=dotted];
10 -> {21} [color=green];
10 -> {21} [style=dashed];
subgraph cluster_3 {
color=red
12 [label="Enter property" style="filled" fillcolor=red];
13 [label="Access variable R|<local>/a|"];
14 [label="Exit property" style="filled" fillcolor=red];
}
12 -> {13};
13 -> {14};
14 -> {10} [color=green];
7 -> {8};
8 -> {9};
10 -> {11} [color=green];
11 -> {12} [style=dotted];
11 -> {38} [color=green];
11 -> {38} [style=dashed];
12 -> {13} [style=dotted];
12 -> {47} [color=green];
12 -> {47} [style=dashed];
subgraph cluster_4 {
color=red
15 [label="Enter function <init>" style="filled" fillcolor=red];
16 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
subgraph cluster_5 {
color=blue
17 [label="Enter block"];
18 [label="Function call: R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
19 [label="Exit block"];
}
20 [label="Exit function <init>" style="filled" fillcolor=red];
38 [label="Enter property" style="filled" fillcolor=red];
39 [label="Access variable R|<local>/a|"];
40 [label="Exit property" style="filled" fillcolor=red];
}
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
38 -> {39};
39 -> {40};
40 -> {12} [color=green];
subgraph cluster_6 {
subgraph cluster_5 {
color=red
21 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_7 {
41 [label="Enter function <init>" style="filled" fillcolor=red];
42 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
subgraph cluster_6 {
color=blue
22 [label="Enter block"];
23 [label="Access variable R|<local>/c|"];
24 [label="Assignment: R|<local>/leaked|"];
25 [label="Exit block"];
43 [label="Enter block"];
44 [label="Function call: R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
45 [label="Exit block"];
}
26 [label="Exit init block" style="filled" fillcolor=red];
46 [label="Exit function <init>" style="filled" fillcolor=red];
}
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {11} [color=green];
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
subgraph cluster_8 {
subgraph cluster_7 {
color=red
27 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_9 {
47 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
28 [label="Enter block"];
29 [label="Function call: R|<local>/d|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
30 [label="Exit block"];
48 [label="Enter block"];
49 [label="Access variable R|<local>/c|"];
50 [label="Assignment: R|<local>/leaked|"];
51 [label="Exit block"];
}
31 [label="Exit function run" style="filled" fillcolor=red];
52 [label="Exit init block" style="filled" fillcolor=red];
}
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {13} [color=green];
subgraph cluster_9 {
color=red
53 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
54 [label="Enter block"];
55 [label="Function call: R|<local>/d|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
56 [label="Exit block"];
}
57 [label="Exit function run" style="filled" fillcolor=red];
}
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
}
@@ -9,7 +9,17 @@ FILE: inLocalClass.kt
CallsInPlace(e, AT_MOST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/a|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/b|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/c|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/d|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/e|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
}
)
}
local final class LocalClass : R|kotlin/Any| {
public final val leakedVal: R|() -> kotlin/Unit| = R|<local>/a|
public get(): R|() -> kotlin/Unit|
@@ -9,38 +9,45 @@ digraph inLocalFunction_kt {
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Local function declaration foo"];
3 [label="Function call: R|<local>/localFun|()" style="filled" fillcolor=yellow];
4 [label="Function call: R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
5 [label="Exit block"];
subgraph cluster_2 {
color=blue
2 [label="Enter block"];
3 [label="Exit block"];
}
4 [label="Local function declaration foo"];
5 [label="Function call: R|<local>/localFun|()" style="filled" fillcolor=yellow];
6 [label="Function call: R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
7 [label="Exit block"];
}
6 [label="Exit function foo" style="filled" fillcolor=red];
8 [label="Exit function foo" style="filled" fillcolor=red];
}
subgraph cluster_2 {
subgraph cluster_3 {
color=blue
7 [label="Enter function localFun" style="filled" fillcolor=red];
subgraph cluster_3 {
9 [label="Enter function localFun" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
8 [label="Enter block"];
9 [label="Access variable R|<local>/a|"];
10 [label="Function call: R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
11 [label="Function call: R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
12 [label="Exit block"];
10 [label="Enter block"];
11 [label="Access variable R|<local>/a|"];
12 [label="Function call: R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
13 [label="Function call: R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
14 [label="Exit block"];
}
13 [label="Exit function localFun" style="filled" fillcolor=red];
15 [label="Exit function localFun" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {7 3};
2 -> {7} [style=dashed];
2 -> {3};
3 -> {4};
4 -> {5};
4 -> {9 5};
4 -> {9} [style=dashed];
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
}
@@ -5,7 +5,13 @@ FILE: inLocalFunction.kt
CallsInPlace(a, AT_MOST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/a|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
}
)
}
local final fun localFun(): R|kotlin/Unit| {
R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
R|<local>/a|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
@@ -25,64 +25,69 @@ digraph toLocalVariables_kt {
5 [label="Enter block"];
subgraph cluster_4 {
color=blue
6 [label="Enter when"];
subgraph cluster_5 {
color=blue
7 [label="Enter when branch condition "];
8 [label="Const: Boolean(true)"];
9 [label="Exit when branch condition"];
}
6 [label="Enter block"];
7 [label="Exit block"];
}
subgraph cluster_5 {
color=blue
8 [label="Enter when"];
subgraph cluster_6 {
color=blue
10 [label="Enter when branch condition else"];
9 [label="Enter when branch condition "];
10 [label="Const: Boolean(true)"];
11 [label="Exit when branch condition"];
}
12 [label="Enter when branch result"];
subgraph cluster_7 {
color=blue
13 [label="Enter block"];
14 [label="Access variable R|<local>/y|"];
15 [label="Variable declaration: lval yCopy: R|() -> kotlin/Unit|"];
16 [label="Function call: R|<local>/yCopy|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
17 [label="Exit block"];
12 [label="Enter when branch condition else"];
13 [label="Exit when branch condition"];
}
18 [label="Exit when branch result"];
19 [label="Enter when branch result"];
14 [label="Enter when branch result"];
subgraph cluster_8 {
color=blue
20 [label="Enter block"];
21 [label="Access variable R|<local>/x|"];
22 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
23 [label="Exit block"];
15 [label="Enter block"];
16 [label="Access variable R|<local>/y|"];
17 [label="Variable declaration: lval yCopy: R|() -> kotlin/Unit|"];
18 [label="Function call: R|<local>/yCopy|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
19 [label="Exit block"];
}
24 [label="Exit when branch result"];
25 [label="Exit when"];
20 [label="Exit when branch result"];
21 [label="Enter when branch result"];
subgraph cluster_9 {
color=blue
22 [label="Enter block"];
23 [label="Access variable R|<local>/x|"];
24 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
25 [label="Exit block"];
}
26 [label="Exit when branch result"];
27 [label="Exit when"];
}
26 [label="Variable declaration: lval zCopy: R|() -> kotlin/Unit|"];
27 [label="Access variable R|<local>/z|"];
28 [label="Assignment: R|<local>/zCopy|"];
29 [label="Function call: R|<local>/zCopy|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
30 [label="Exit block"];
28 [label="Variable declaration: lval zCopy: R|() -> kotlin/Unit|"];
29 [label="Access variable R|<local>/z|"];
30 [label="Assignment: R|<local>/zCopy|"];
31 [label="Function call: R|<local>/zCopy|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
32 [label="Exit block"];
}
31 [label="Exit function foo" style="filled" fillcolor=red];
33 [label="Exit function foo" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {19 10};
9 -> {10};
10 -> {11};
11 -> {12};
11 -> {21 12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {25};
18 -> {19};
19 -> {20};
20 -> {21};
20 -> {27};
21 -> {22};
22 -> {23};
23 -> {24};
@@ -93,5 +98,7 @@ digraph toLocalVariables_kt {
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
}
@@ -9,7 +9,15 @@ FILE: toLocalVariables.kt
CallsInPlace(z, AT_MOST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/x|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/y|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/z|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
}
)
}
when () {
Boolean(true) -> {
R|/bar|(R|<local>/x|)
@@ -0,0 +1,29 @@
FILE: noOptIn.kt
public final fun checkIsString(x: R|kotlin/Any|): R|kotlin/Boolean|
[R|Contract description]
<
Returns(TRUE) -> x is kotlin/String
Returns(FALSE) -> x !is kotlin/String
>
{
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/String|))
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(false)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| !is R|kotlin/String|))
}
)
}
^checkIsString (R|<local>/x| is R|kotlin/String|)
}
public final fun test(x: R|kotlin/Any|): R|kotlin/Unit| {
when () {
R|/checkIsString|(R|<local>/x|) -> {
R|<local>/x|.R|kotlin/String.length|
}
else -> {
R|<local>/x|.<Unresolved name: length>#
}
}
}
@@ -0,0 +1,17 @@
import kotlin.contracts.*
fun checkIsString(x: Any): Boolean {
<!OPT_IN_USAGE_ERROR!>contract<!> {
<!OPT_IN_USAGE_ERROR!>returns<!>(true) <!OPT_IN_USAGE_ERROR!>implies<!> (x is String)
<!OPT_IN_USAGE_ERROR!>returns<!>(false) <!OPT_IN_USAGE_ERROR!>implies<!> (x !is String)
}
return x is String
}
fun test(x: Any) {
if (checkIsString(x)) {
x.length // OK
} else {
x.<!UNRESOLVED_REFERENCE!>length<!> // Error
}
}
@@ -5,7 +5,13 @@ FILE: notNull.kt
Returns(NULL) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Null(null)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
when () {
Boolean(true) -> {
throw Q|java/lang|.R|java/lang/IllegalArgumentException.IllegalArgumentException|()
@@ -20,7 +26,13 @@ FILE: notNull.kt
Returns(WILDCARD) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|().R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
when () {
==(R|<local>/x|, Null(null)) -> {
^bar R|<local>/x|
@@ -35,6 +47,12 @@ FILE: notNull.kt
Returns(NULL) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Null(null)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^baz R|<local>/x|
}
@@ -5,7 +5,13 @@ FILE: propertyGetter.kt
Returns(TRUE) -> this != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(this@R|/isNotNull|, Null(null)))
}
)
}
^isNotNull !=(this@R|/isNotNull|, Null(null))
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final val R|kotlin/Any?|.isNotNull: R|kotlin/Boolean|
@@ -15,6 +21,12 @@ FILE: propertyGetter.kt
Returns(TRUE) -> this != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(this@R|/isNotNull|, Null(null)))
}
)
}
^ !=(this@R|/isNotNull|, Null(null))
}
@@ -0,0 +1,31 @@
FILE: redundantConditions.kt
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun testAlwaysNotNull(x: R|kotlin/String?|): R|kotlin/Any?|
[R|Contract description]
<
Returns(NOT_NULL) -> x is kotlin/String && x != null
>
{
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/String|) && !=(R|<local>/x|, Null(null)))
}
)
}
^testAlwaysNotNull R|<local>/x|
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun testAlwaysAny(x: R|kotlin/String?|): R|kotlin/Any?|
[R|Contract description]
<
Returns(NOT_NULL) -> x is kotlin/String? || x is kotlin/Any?
>
{
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/String?|) || (R|<local>/x| is R|kotlin/Any?|))
}
)
}
^testAlwaysAny R|<local>/x|
}
@@ -0,0 +1,20 @@
// !OPT_IN: kotlin.RequiresOptIn
import kotlin.contracts.*
@OptIn(ExperimentalContracts::class)
fun testAlwaysNotNull(x: String?): Any? {
contract {
returnsNotNull() implies (x is String && <!SENSELESS_COMPARISON!>x != null<!>)
}
return x
}
@OptIn(ExperimentalContracts::class)
fun testAlwaysAny(x: String?): Any? {
contract {
returnsNotNull() implies (<!USELESS_IS_CHECK!>x is String?<!> || <!USELESS_IS_CHECK!>x is Any?<!>)
}
return x
}
@@ -9,124 +9,138 @@ digraph atLeastOnce_kt {
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
3 [label="Exit block"];
subgraph cluster_2 {
color=blue
2 [label="Enter block"];
3 [label="Exit block"];
}
4 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
5 [label="Exit block"];
}
4 [label="Exit function inlineRun" style="filled" fillcolor=red];
6 [label="Exit function inlineRun" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
subgraph cluster_2 {
color=red
5 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
6 [label="Enter block"];
7 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
8 [label="Exit block"];
}
9 [label="Exit function myRun" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
subgraph cluster_4 {
subgraph cluster_3 {
color=red
10 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_5 {
15 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
11 [label="Enter block"];
12 [label="Variable declaration: lval x: R|kotlin/Int|"];
13 [label="Postponed enter to lambda"];
subgraph cluster_6 {
16 [label="Enter block"];
subgraph cluster_5 {
color=blue
20 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
21 [label="Enter block"];
22 [label="Const: Int(1)"];
23 [label="Assignment: R|<local>/x|"];
24 [label="Exit block"];
}
25 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
17 [label="Enter block"];
18 [label="Exit block"];
}
14 [label="Postponed exit from lambda"];
15 [label="Function call: R|/inlineRun|(...)" style="filled" fillcolor=yellow];
16 [label="Access variable R|<local>/x|"];
17 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
18 [label="Exit block"];
19 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
20 [label="Exit block"];
}
19 [label="Exit function test_1" style="filled" fillcolor=red];
21 [label="Exit function myRun" style="filled" fillcolor=red];
}
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {20 15};
13 -> {14} [style=dotted];
13 -> {20} [style=dashed];
14 -> {15};
14 -> {13} [color=green style=dashed];
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {14};
subgraph cluster_8 {
subgraph cluster_6 {
color=red
26 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_9 {
30 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
27 [label="Enter block"];
28 [label="Variable declaration: lval x: R|kotlin/Int|"];
29 [label="Postponed enter to lambda"];
subgraph cluster_10 {
31 [label="Enter block"];
32 [label="Variable declaration: lval x: R|kotlin/Int|"];
33 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
36 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_11 {
40 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
37 [label="Enter block"];
38 [label="Const: Int(1)"];
39 [label="Assignment: R|<local>/x|"];
40 [label="Exit block"];
41 [label="Enter block"];
42 [label="Const: Int(1)"];
43 [label="Assignment: R|<local>/x|"];
44 [label="Exit block"];
}
41 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
45 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
30 [label="Postponed exit from lambda"];
31 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
32 [label="Access variable R|<local>/x|"];
33 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
34 [label="Exit block"];
34 [label="Postponed exit from lambda"];
35 [label="Function call: R|/inlineRun|(...)" style="filled" fillcolor=yellow];
36 [label="Access variable R|<local>/x|"];
37 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
38 [label="Exit block"];
}
35 [label="Exit function test_2" style="filled" fillcolor=red];
39 [label="Exit function test_1" style="filled" fillcolor=red];
}
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {36 31};
29 -> {30} [style=dotted];
29 -> {36} [style=dashed];
30 -> {31};
30 -> {29} [color=green style=dashed];
31 -> {32};
32 -> {33};
33 -> {34};
33 -> {40 35};
33 -> {34} [style=dotted];
33 -> {40} [style=dashed];
34 -> {35};
34 -> {33} [color=green style=dashed];
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {30};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {34};
subgraph cluster_10 {
color=red
46 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
47 [label="Enter block"];
48 [label="Variable declaration: lval x: R|kotlin/Int|"];
49 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
56 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
57 [label="Enter block"];
58 [label="Const: Int(1)"];
59 [label="Assignment: R|<local>/x|"];
60 [label="Exit block"];
}
61 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
50 [label="Postponed exit from lambda"];
51 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
52 [label="Access variable R|<local>/x|"];
53 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
54 [label="Exit block"];
}
55 [label="Exit function test_2" style="filled" fillcolor=red];
}
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {56 51};
49 -> {50} [style=dotted];
49 -> {56} [style=dashed];
50 -> {51};
50 -> {49} [color=green style=dashed];
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {50};
}
@@ -1,20 +1,32 @@
FILE: atLeastOnce.kt
public final inline fun inlineRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final inline fun inlineRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(block, AT_LEAST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/block|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_LEAST_ONCE|)
}
)
}
R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun myRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun myRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(block, AT_LEAST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/block|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_LEAST_ONCE|)
}
)
}
R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun test_1(): R|kotlin/Unit| {
@@ -2,6 +2,7 @@
import kotlin.contracts.*
@OptIn(ExperimentalContracts::class)
inline fun inlineRun(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.AT_LEAST_ONCE)
@@ -9,6 +10,7 @@ inline fun inlineRun(block: () -> Unit) {
block()
}
@OptIn(ExperimentalContracts::class)
fun myRun(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.AT_LEAST_ONCE)
@@ -9,120 +9,134 @@ digraph atMostOnce_kt {
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
3 [label="Exit block"];
subgraph cluster_2 {
color=blue
2 [label="Enter block"];
3 [label="Exit block"];
}
4 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
5 [label="Exit block"];
}
4 [label="Exit function inlineRun" style="filled" fillcolor=red];
6 [label="Exit function inlineRun" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
subgraph cluster_2 {
color=red
5 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
6 [label="Enter block"];
7 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
8 [label="Exit block"];
}
9 [label="Exit function myRun" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
subgraph cluster_4 {
subgraph cluster_3 {
color=red
10 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_5 {
15 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
11 [label="Enter block"];
12 [label="Variable declaration: lval x: R|kotlin/Int|"];
13 [label="Postponed enter to lambda"];
subgraph cluster_6 {
16 [label="Enter block"];
subgraph cluster_5 {
color=blue
20 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
21 [label="Enter block"];
22 [label="Const: Int(1)"];
23 [label="Assignment: R|<local>/x|"];
24 [label="Exit block"];
}
25 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
17 [label="Enter block"];
18 [label="Exit block"];
}
14 [label="Postponed exit from lambda"];
15 [label="Function call: R|/inlineRun|(...)" style="filled" fillcolor=yellow];
16 [label="Access variable R|<local>/x|"];
17 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
18 [label="Exit block"];
19 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
20 [label="Exit block"];
}
19 [label="Exit function test_1" style="filled" fillcolor=red];
21 [label="Exit function myRun" style="filled" fillcolor=red];
}
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14 20 15};
13 -> {20} [style=dashed];
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {14};
subgraph cluster_8 {
subgraph cluster_6 {
color=red
26 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_9 {
30 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
27 [label="Enter block"];
28 [label="Variable declaration: lval x: R|kotlin/Int|"];
29 [label="Postponed enter to lambda"];
subgraph cluster_10 {
31 [label="Enter block"];
32 [label="Variable declaration: lval x: R|kotlin/Int|"];
33 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
36 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_11 {
40 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
37 [label="Enter block"];
38 [label="Const: Int(1)"];
39 [label="Assignment: R|<local>/x|"];
40 [label="Exit block"];
41 [label="Enter block"];
42 [label="Const: Int(1)"];
43 [label="Assignment: R|<local>/x|"];
44 [label="Exit block"];
}
41 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
45 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
30 [label="Postponed exit from lambda"];
31 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
32 [label="Access variable R|<local>/x|"];
33 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
34 [label="Exit block"];
34 [label="Postponed exit from lambda"];
35 [label="Function call: R|/inlineRun|(...)" style="filled" fillcolor=yellow];
36 [label="Access variable R|<local>/x|"];
37 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
38 [label="Exit block"];
}
35 [label="Exit function test_2" style="filled" fillcolor=red];
39 [label="Exit function test_1" style="filled" fillcolor=red];
}
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30 36 31};
29 -> {36} [style=dashed];
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
33 -> {34 40 35};
33 -> {40} [style=dashed];
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {30};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {34};
subgraph cluster_10 {
color=red
46 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
47 [label="Enter block"];
48 [label="Variable declaration: lval x: R|kotlin/Int|"];
49 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
56 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
57 [label="Enter block"];
58 [label="Const: Int(1)"];
59 [label="Assignment: R|<local>/x|"];
60 [label="Exit block"];
}
61 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
50 [label="Postponed exit from lambda"];
51 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
52 [label="Access variable R|<local>/x|"];
53 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
54 [label="Exit block"];
}
55 [label="Exit function test_2" style="filled" fillcolor=red];
}
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50 56 51};
49 -> {56} [style=dashed];
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {50};
}
@@ -1,20 +1,32 @@
FILE: atMostOnce.kt
public final inline fun inlineRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final inline fun inlineRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(block, AT_MOST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/block|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
}
)
}
R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun myRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun myRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(block, AT_MOST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/block|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
}
)
}
R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun test_1(): R|kotlin/Unit| {
@@ -2,6 +2,7 @@
import kotlin.contracts.*
@OptIn(ExperimentalContracts::class)
inline fun inlineRun(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -9,6 +10,7 @@ inline fun inlineRun(block: () -> Unit) {
block()
}
@OptIn(ExperimentalContracts::class)
fun myRun(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -9,123 +9,144 @@ digraph contractsUsage_kt {
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Access variable R|<local>/x|"];
3 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
4 [label="Exit block"];
subgraph cluster_2 {
color=blue
2 [label="Enter block"];
3 [label="Exit block"];
}
4 [label="Access variable R|<local>/x|"];
5 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
6 [label="Exit block"];
}
5 [label="Exit function bar" style="filled" fillcolor=red];
7 [label="Exit function bar" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {5};
subgraph cluster_2 {
color=red
6 [label="Enter function baz" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
7 [label="Enter block"];
subgraph cluster_4 {
color=blue
8 [label="Enter when"];
subgraph cluster_5 {
color=blue
9 [label="Enter when branch condition "];
10 [label="Const: Boolean(true)"];
11 [label="Exit when branch condition"];
}
12 [label="Synthetic else branch"];
13 [label="Enter when branch result"];
subgraph cluster_6 {
color=blue
14 [label="Enter block"];
15 [label="Access variable this@R|/baz|"];
16 [label="Function call: this@R|/baz|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
17 [label="Exit block"];
}
18 [label="Exit when branch result"];
19 [label="Exit when"];
}
20 [label="Exit block"];
}
21 [label="Exit function baz" style="filled" fillcolor=red];
}
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {13 12};
12 -> {19};
13 -> {14};
14 -> {15};
15 -> {16};
subgraph cluster_3 {
color=red
16 [label="Enter function baz" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
17 [label="Enter block"];
subgraph cluster_5 {
color=blue
18 [label="Enter block"];
19 [label="Exit block"];
}
subgraph cluster_6 {
color=blue
20 [label="Enter when"];
subgraph cluster_7 {
color=blue
21 [label="Enter when branch condition "];
22 [label="Const: Boolean(true)"];
23 [label="Exit when branch condition"];
}
24 [label="Synthetic else branch"];
25 [label="Enter when branch result"];
subgraph cluster_8 {
color=blue
26 [label="Enter block"];
27 [label="Access variable this@R|/baz|"];
28 [label="Function call: this@R|/baz|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
29 [label="Exit block"];
}
30 [label="Exit when branch result"];
31 [label="Exit when"];
}
32 [label="Exit block"];
}
33 [label="Exit function baz" style="filled" fillcolor=red];
}
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
subgraph cluster_7 {
color=red
22 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
23 [label="Enter block"];
subgraph cluster_9 {
color=blue
24 [label="Enter when"];
subgraph cluster_10 {
color=blue
25 [label="Enter when branch condition "];
26 [label="Const: Boolean(true)"];
27 [label="Exit when branch condition"];
}
28 [label="Synthetic else branch"];
29 [label="Enter when branch result"];
subgraph cluster_11 {
color=blue
30 [label="Enter block"];
31 [label="Access variable R|<local>/x|"];
32 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
33 [label="Access variable R|<local>/y|"];
34 [label="Function call: R|<local>/y|.R|/baz|()" style="filled" fillcolor=yellow];
35 [label="Jump: ^foo Unit"];
36 [label="Stub" style="filled" fillcolor=gray];
37 [label="Exit block" style="filled" fillcolor=gray];
}
38 [label="Exit when branch result" style="filled" fillcolor=gray];
39 [label="Exit when"];
}
40 [label="Access variable R|<local>/x|"];
41 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
42 [label="Exit block"];
}
43 [label="Exit function foo" style="filled" fillcolor=red];
}
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
23 -> {25 24};
24 -> {31};
25 -> {26};
26 -> {27};
27 -> {29 28};
28 -> {39};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {43};
35 -> {36} [style=dotted];
36 -> {37} [style=dotted];
37 -> {38} [style=dotted];
38 -> {39} [style=dotted];
39 -> {40};
40 -> {41};
41 -> {42};
subgraph cluster_9 {
color=red
42 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
43 [label="Enter block"];
subgraph cluster_11 {
color=blue
44 [label="Enter block"];
45 [label="Exit block"];
}
subgraph cluster_12 {
color=blue
46 [label="Enter when"];
subgraph cluster_13 {
color=blue
47 [label="Enter when branch condition "];
48 [label="Const: Boolean(true)"];
49 [label="Exit when branch condition"];
}
50 [label="Synthetic else branch"];
51 [label="Enter when branch result"];
subgraph cluster_14 {
color=blue
52 [label="Enter block"];
53 [label="Access variable R|<local>/x|"];
54 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
55 [label="Access variable R|<local>/y|"];
56 [label="Function call: R|<local>/y|.R|/baz|()" style="filled" fillcolor=yellow];
57 [label="Jump: ^foo Unit"];
58 [label="Stub" style="filled" fillcolor=gray];
59 [label="Exit block" style="filled" fillcolor=gray];
}
60 [label="Exit when branch result" style="filled" fillcolor=gray];
61 [label="Exit when"];
}
62 [label="Access variable R|<local>/x|"];
63 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
64 [label="Exit block"];
}
65 [label="Exit function foo" style="filled" fillcolor=red];
}
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {51 50};
50 -> {61};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {65};
57 -> {58} [style=dotted];
58 -> {59} [style=dotted];
59 -> {60} [style=dotted];
60 -> {61} [style=dotted];
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
}
@@ -1,20 +1,32 @@
FILE: contractsUsage.kt
@R|kotlin/contracts/ExperimentalContracts|() public final fun bar(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun bar(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(x, EXACTLY_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/x|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.EXACTLY_ONCE|)
}
)
}
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
@R|kotlin/contracts/ExperimentalContracts|() public final fun R|() -> kotlin/Unit|.baz(): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun R|() -> kotlin/Unit|.baz(): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(this, AT_MOST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(this@R|/baz|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
}
)
}
when () {
Boolean(true) -> {
this@R|/baz|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
@@ -22,14 +34,21 @@ FILE: contractsUsage.kt
}
}
@R|kotlin/contracts/ExperimentalContracts|() public final fun foo(x: R|() -> kotlin/Unit|, y: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun foo(x: R|() -> kotlin/Unit|, y: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(x, AT_LEAST_ONCE)
CallsInPlace(y, AT_MOST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/x|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_LEAST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/y|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
}
)
}
when () {
Boolean(true) -> {
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
@@ -1,7 +1,7 @@
// !DUMP_CFG
import kotlin.contracts.*
@ExperimentalContracts
@OptIn(ExperimentalContracts::class)
fun bar(x: () -> Unit) {
contract {
callsInPlace(x, InvocationKind.EXACTLY_ONCE)
@@ -10,7 +10,7 @@ fun bar(x: () -> Unit) {
x.invoke()
}
@ExperimentalContracts
@OptIn(ExperimentalContracts::class)
fun (() -> Unit).baz() {
contract {
callsInPlace(this@baz, InvocationKind.AT_MOST_ONCE)
@@ -21,7 +21,7 @@ fun (() -> Unit).baz() {
}
}
@ExperimentalContracts
@OptIn(ExperimentalContracts::class)
fun foo(x: () -> Unit, y: () -> Unit) {
contract {
callsInPlace(x, InvocationKind.AT_LEAST_ONCE)
@@ -9,122 +9,136 @@ digraph exactlyOnce_kt {
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
3 [label="Exit block"];
subgraph cluster_2 {
color=blue
2 [label="Enter block"];
3 [label="Exit block"];
}
4 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
5 [label="Exit block"];
}
4 [label="Exit function inlineRun" style="filled" fillcolor=red];
6 [label="Exit function inlineRun" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
subgraph cluster_2 {
color=red
5 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
6 [label="Enter block"];
7 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
8 [label="Exit block"];
}
9 [label="Exit function myRun" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
subgraph cluster_4 {
subgraph cluster_3 {
color=red
10 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_5 {
15 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
11 [label="Enter block"];
12 [label="Variable declaration: lval x: R|kotlin/Int|"];
13 [label="Postponed enter to lambda"];
subgraph cluster_6 {
16 [label="Enter block"];
subgraph cluster_5 {
color=blue
20 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
21 [label="Enter block"];
22 [label="Const: Int(1)"];
23 [label="Assignment: R|<local>/x|"];
24 [label="Exit block"];
}
25 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
17 [label="Enter block"];
18 [label="Exit block"];
}
14 [label="Postponed exit from lambda"];
15 [label="Function call: R|/inlineRun|(...)" style="filled" fillcolor=yellow];
16 [label="Access variable R|<local>/x|"];
17 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
18 [label="Exit block"];
19 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
20 [label="Exit block"];
}
19 [label="Exit function test_1" style="filled" fillcolor=red];
21 [label="Exit function myRun" style="filled" fillcolor=red];
}
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {20 15};
13 -> {14} [style=dotted];
13 -> {20} [style=dashed];
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {14};
subgraph cluster_8 {
subgraph cluster_6 {
color=red
26 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_9 {
30 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
27 [label="Enter block"];
28 [label="Variable declaration: lval x: R|kotlin/Int|"];
29 [label="Postponed enter to lambda"];
subgraph cluster_10 {
31 [label="Enter block"];
32 [label="Variable declaration: lval x: R|kotlin/Int|"];
33 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
36 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_11 {
40 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
37 [label="Enter block"];
38 [label="Const: Int(1)"];
39 [label="Assignment: R|<local>/x|"];
40 [label="Exit block"];
41 [label="Enter block"];
42 [label="Const: Int(1)"];
43 [label="Assignment: R|<local>/x|"];
44 [label="Exit block"];
}
41 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
45 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
30 [label="Postponed exit from lambda"];
31 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
32 [label="Access variable R|<local>/x|"];
33 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
34 [label="Exit block"];
34 [label="Postponed exit from lambda"];
35 [label="Function call: R|/inlineRun|(...)" style="filled" fillcolor=yellow];
36 [label="Access variable R|<local>/x|"];
37 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
38 [label="Exit block"];
}
35 [label="Exit function test_2" style="filled" fillcolor=red];
39 [label="Exit function test_1" style="filled" fillcolor=red];
}
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {36 31};
29 -> {30} [style=dotted];
29 -> {36} [style=dashed];
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
33 -> {40 35};
33 -> {34} [style=dotted];
33 -> {40} [style=dashed];
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {30};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {34};
subgraph cluster_10 {
color=red
46 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
47 [label="Enter block"];
48 [label="Variable declaration: lval x: R|kotlin/Int|"];
49 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
56 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
57 [label="Enter block"];
58 [label="Const: Int(1)"];
59 [label="Assignment: R|<local>/x|"];
60 [label="Exit block"];
}
61 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
50 [label="Postponed exit from lambda"];
51 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
52 [label="Access variable R|<local>/x|"];
53 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
54 [label="Exit block"];
}
55 [label="Exit function test_2" style="filled" fillcolor=red];
}
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {56 51};
49 -> {50} [style=dotted];
49 -> {56} [style=dashed];
50 -> {51};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {50};
}
@@ -1,20 +1,32 @@
FILE: exactlyOnce.kt
public final inline fun inlineRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final inline fun inlineRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(block, EXACTLY_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/block|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.EXACTLY_ONCE|)
}
)
}
R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun myRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun myRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(block, EXACTLY_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/block|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.EXACTLY_ONCE|)
}
)
}
R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun test_1(): R|kotlin/Unit| {
@@ -2,6 +2,7 @@
import kotlin.contracts.*
@OptIn(ExperimentalContracts::class)
inline fun inlineRun(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
@@ -9,6 +10,7 @@ inline fun inlineRun(block: () -> Unit) {
block()
}
@OptIn(ExperimentalContracts::class)
fun myRun(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
@@ -11,221 +11,222 @@ digraph flow_kt {
1 [label="Enter block"];
subgraph cluster_2 {
color=blue
2 [label="Enter when"];
subgraph cluster_3 {
color=blue
3 [label="Enter when branch condition "];
4 [label="Const: Boolean(true)"];
5 [label="Exit when branch condition"];
}
6 [label="Synthetic else branch"];
7 [label="Enter when branch result"];
2 [label="Enter block"];
3 [label="Exit block"];
}
subgraph cluster_3 {
color=blue
4 [label="Enter when"];
subgraph cluster_4 {
color=blue
8 [label="Enter block"];
9 [label="Access variable R|<local>/x|"];
10 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
11 [label="Jump: ^bar Unit"];
12 [label="Stub" style="filled" fillcolor=gray];
13 [label="Exit block" style="filled" fillcolor=gray];
5 [label="Enter when branch condition "];
6 [label="Const: Boolean(true)"];
7 [label="Exit when branch condition"];
}
14 [label="Exit when branch result" style="filled" fillcolor=gray];
15 [label="Exit when"];
8 [label="Synthetic else branch"];
9 [label="Enter when branch result"];
subgraph cluster_5 {
color=blue
10 [label="Enter block"];
11 [label="Access variable R|<local>/x|"];
12 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
13 [label="Jump: ^bar Unit"];
14 [label="Stub" style="filled" fillcolor=gray];
15 [label="Exit block" style="filled" fillcolor=gray];
}
16 [label="Exit when branch result" style="filled" fillcolor=gray];
17 [label="Exit when"];
}
16 [label="Access variable R|<local>/x|"];
17 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
18 [label="Exit block"];
18 [label="Access variable R|<local>/x|"];
19 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
20 [label="Exit block"];
}
19 [label="Exit function bar" style="filled" fillcolor=red];
21 [label="Exit function bar" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {7 6};
6 -> {15};
7 -> {8};
8 -> {9};
5 -> {6};
6 -> {7};
7 -> {9 8};
8 -> {17};
9 -> {10};
10 -> {11};
11 -> {19};
11 -> {12} [style=dotted];
12 -> {13} [style=dotted];
11 -> {12};
12 -> {13};
13 -> {21};
13 -> {14} [style=dotted];
14 -> {15} [style=dotted];
15 -> {16};
16 -> {17};
15 -> {16} [style=dotted];
16 -> {17} [style=dotted];
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
subgraph cluster_5 {
subgraph cluster_6 {
color=red
20 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_6 {
30 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
21 [label="Enter block"];
subgraph cluster_7 {
31 [label="Enter block"];
subgraph cluster_8 {
color=blue
22 [label="Enter when"];
subgraph cluster_8 {
color=blue
23 [label="Enter when branch condition "];
24 [label="Const: Boolean(true)"];
25 [label="Exit when branch condition"];
}
subgraph cluster_9 {
color=blue
26 [label="Enter when branch condition else"];
27 [label="Exit when branch condition"];
}
28 [label="Enter when branch result"];
32 [label="Enter block"];
33 [label="Exit block"];
}
subgraph cluster_9 {
color=blue
34 [label="Enter when"];
subgraph cluster_10 {
color=blue
29 [label="Enter block"];
subgraph cluster_11 {
35 [label="Enter when branch condition "];
36 [label="Const: Boolean(true)"];
37 [label="Exit when branch condition"];
}
subgraph cluster_11 {
color=blue
38 [label="Enter when branch condition else"];
39 [label="Exit when branch condition"];
}
40 [label="Enter when branch result"];
subgraph cluster_12 {
color=blue
41 [label="Enter block"];
subgraph cluster_13 {
color=blue
30 [label="Enter when"];
subgraph cluster_12 {
color=blue
31 [label="Enter when branch condition "];
32 [label="Const: Boolean(false)"];
33 [label="Exit when branch condition"];
}
subgraph cluster_13 {
color=blue
34 [label="Enter when branch condition else"];
35 [label="Exit when branch condition"];
}
36 [label="Enter when branch result"];
42 [label="Enter when"];
subgraph cluster_14 {
color=blue
37 [label="Enter block"];
38 [label="Access variable R|<local>/y|"];
39 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
40 [label="Access variable R|<local>/z|"];
41 [label="Function call: R|<local>/z|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
42 [label="Jump: ^foo Unit"];
43 [label="Stub" style="filled" fillcolor=gray];
44 [label="Exit block" style="filled" fillcolor=gray];
43 [label="Enter when branch condition "];
44 [label="Const: Boolean(false)"];
45 [label="Exit when branch condition"];
}
45 [label="Exit when branch result" style="filled" fillcolor=gray];
46 [label="Enter when branch result"];
subgraph cluster_15 {
color=blue
47 [label="Enter block"];
48 [label="Access variable R|<local>/y|"];
49 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
50 [label="Exit block"];
46 [label="Enter when branch condition else"];
47 [label="Exit when branch condition"];
}
51 [label="Exit when branch result"];
52 [label="Exit when"];
}
53 [label="Exit block"];
}
54 [label="Exit when branch result"];
55 [label="Enter when branch result"];
subgraph cluster_16 {
color=blue
56 [label="Enter block"];
subgraph cluster_17 {
color=blue
57 [label="Enter block"];
58 [label="Const: Int(0)"];
59 [label="Const: Int(0)"];
60 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...)" style="filled" fillcolor=yellow];
61 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...).R|kotlin/ranges/IntProgression.iterator|()" style="filled" fillcolor=yellow];
62 [label="Variable declaration: lval <iterator>: R|kotlin/collections/IntIterator|"];
subgraph cluster_18 {
48 [label="Enter when branch result"];
subgraph cluster_16 {
color=blue
63 [label="Enter while loop"];
subgraph cluster_19 {
color=blue
64 [label="Enter loop condition"];
65 [label="Access variable R|<local>/<iterator>|"];
66 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()" style="filled" fillcolor=yellow];
67 [label="Exit loop condition"];
}
subgraph cluster_20 {
color=blue
68 [label="Enter loop block"];
subgraph cluster_21 {
color=blue
69 [label="Enter block"];
70 [label="Access variable R|<local>/<iterator>|"];
71 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()" style="filled" fillcolor=yellow];
72 [label="Variable declaration: lval i: R|kotlin/Int|"];
73 [label="Access variable R|<local>/x|"];
74 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
75 [label="Exit block"];
}
76 [label="Exit loop block"];
}
77 [label="Exit whileloop"];
49 [label="Enter block"];
50 [label="Access variable R|<local>/y|"];
51 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
52 [label="Access variable R|<local>/z|"];
53 [label="Function call: R|<local>/z|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
54 [label="Jump: ^foo Unit"];
55 [label="Stub" style="filled" fillcolor=gray];
56 [label="Exit block" style="filled" fillcolor=gray];
}
78 [label="Exit block"];
57 [label="Exit when branch result" style="filled" fillcolor=gray];
58 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
59 [label="Enter block"];
60 [label="Access variable R|<local>/y|"];
61 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
62 [label="Exit block"];
}
63 [label="Exit when branch result"];
64 [label="Exit when"];
}
79 [label="Access variable R|<local>/y|"];
80 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
81 [label="Exit block"];
65 [label="Exit block"];
}
82 [label="Exit when branch result"];
83 [label="Exit when"];
}
subgraph cluster_22 {
color=blue
84 [label="Enter do-while loop"];
subgraph cluster_23 {
66 [label="Exit when branch result"];
67 [label="Enter when branch result"];
subgraph cluster_18 {
color=blue
85 [label="Enter loop block"];
subgraph cluster_24 {
68 [label="Enter block"];
subgraph cluster_19 {
color=blue
86 [label="Enter block"];
87 [label="Access variable R|<local>/z|"];
88 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
89 [label="Exit block"];
69 [label="Enter block"];
70 [label="Const: Int(0)"];
71 [label="Const: Int(0)"];
72 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...)" style="filled" fillcolor=yellow];
73 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...).R|kotlin/ranges/IntProgression.iterator|()" style="filled" fillcolor=yellow];
74 [label="Variable declaration: lval <iterator>: R|kotlin/collections/IntIterator|"];
subgraph cluster_20 {
color=blue
75 [label="Enter while loop"];
subgraph cluster_21 {
color=blue
76 [label="Enter loop condition"];
77 [label="Access variable R|<local>/<iterator>|"];
78 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()" style="filled" fillcolor=yellow];
79 [label="Exit loop condition"];
}
subgraph cluster_22 {
color=blue
80 [label="Enter loop block"];
subgraph cluster_23 {
color=blue
81 [label="Enter block"];
82 [label="Access variable R|<local>/<iterator>|"];
83 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()" style="filled" fillcolor=yellow];
84 [label="Variable declaration: lval i: R|kotlin/Int|"];
85 [label="Access variable R|<local>/x|"];
86 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
87 [label="Exit block"];
}
88 [label="Exit loop block"];
}
89 [label="Exit whileloop"];
}
90 [label="Exit block"];
}
90 [label="Exit loop block"];
91 [label="Access variable R|<local>/y|"];
92 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
93 [label="Exit block"];
}
94 [label="Exit when branch result"];
95 [label="Exit when"];
}
subgraph cluster_24 {
color=blue
96 [label="Enter do-while loop"];
subgraph cluster_25 {
color=blue
91 [label="Enter loop condition"];
92 [label="Const: Boolean(true)"];
93 [label="Exit loop condition"];
97 [label="Enter loop block"];
subgraph cluster_26 {
color=blue
98 [label="Enter block"];
99 [label="Access variable R|<local>/z|"];
100 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
101 [label="Exit block"];
}
102 [label="Exit loop block"];
}
94 [label="Exit do-whileloop" style="filled" fillcolor=gray];
subgraph cluster_27 {
color=blue
103 [label="Enter loop condition"];
104 [label="Const: Boolean(true)"];
105 [label="Exit loop condition"];
}
106 [label="Exit do-whileloop" style="filled" fillcolor=gray];
}
95 [label="Exit block" style="filled" fillcolor=gray];
107 [label="Exit block" style="filled" fillcolor=gray];
}
96 [label="Exit function foo" style="filled" fillcolor=red];
108 [label="Exit function foo" style="filled" fillcolor=red];
}
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {55 26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {46 34};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
37 -> {38};
37 -> {67 38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {96};
42 -> {43} [style=dotted];
43 -> {44} [style=dotted];
44 -> {45} [style=dotted];
45 -> {52} [style=dotted];
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {58 46};
46 -> {47};
47 -> {48};
48 -> {49};
@@ -234,10 +235,11 @@ digraph flow_kt {
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {83};
55 -> {56};
56 -> {57};
57 -> {58};
54 -> {108};
54 -> {55} [style=dotted];
55 -> {56} [style=dotted];
56 -> {57} [style=dotted];
57 -> {64} [style=dotted];
58 -> {59};
59 -> {60};
60 -> {61};
@@ -246,8 +248,8 @@ digraph flow_kt {
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {77 68};
66 -> {95};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {71};
@@ -256,10 +258,10 @@ digraph flow_kt {
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {64} [color=green style=dashed];
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {80};
79 -> {89 80};
80 -> {81};
81 -> {82};
82 -> {83};
@@ -268,14 +270,26 @@ digraph flow_kt {
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
88 -> {76} [color=green style=dashed];
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {93};
93 -> {94} [style=dotted];
93 -> {85} [color=green style=dashed];
94 -> {95} [style=dotted];
95 -> {96} [style=dotted];
93 -> {94};
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {100};
100 -> {101};
101 -> {102};
102 -> {103};
103 -> {104};
104 -> {105};
105 -> {106} [style=dotted];
105 -> {97} [color=green style=dashed];
106 -> {107} [style=dotted];
107 -> {108} [style=dotted];
}
@@ -1,11 +1,17 @@
FILE: flow.kt
@R|kotlin/contracts/ExperimentalContracts|() public final fun bar(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun bar(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(x, EXACTLY_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/x|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.EXACTLY_ONCE|)
}
)
}
when () {
Boolean(true) -> {
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
@@ -15,7 +21,7 @@ FILE: flow.kt
R|/bar|(R|<local>/x|)
}
@R|kotlin/contracts/ExperimentalContracts|() public final fun foo(x: R|() -> kotlin/Unit|, y: R|() -> kotlin/Unit|, z: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun foo(x: R|() -> kotlin/Unit|, y: R|() -> kotlin/Unit|, z: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(x, UNKNOWN)
@@ -23,7 +29,15 @@ FILE: flow.kt
CallsInPlace(z, AT_LEAST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/x|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.UNKNOWN|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/y|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.EXACTLY_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/z|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_LEAST_ONCE|)
}
)
}
when () {
Boolean(true) -> {
{
@@ -1,7 +1,7 @@
// !DUMP_CFG
import kotlin.contracts.*
@ExperimentalContracts
@OptIn(ExperimentalContracts::class)
fun bar(x: () -> Unit) {
contract {
callsInPlace(x, InvocationKind.EXACTLY_ONCE)
@@ -15,7 +15,7 @@ fun bar(x: () -> Unit) {
bar(x)
}
@ExperimentalContracts
@OptIn(ExperimentalContracts::class)
fun foo(x: () -> Unit, y: () -> Unit, z: () -> Unit) {
contract {
callsInPlace(x, InvocationKind.UNKNOWN)
@@ -11,80 +11,94 @@ digraph inPlaceLambda_kt {
1 [label="Enter block"];
subgraph cluster_2 {
color=blue
2 [label="Enter when"];
subgraph cluster_3 {
color=blue
3 [label="Enter when branch condition "];
4 [label="Const: Boolean(true)"];
5 [label="Exit when branch condition"];
}
6 [label="Synthetic else branch"];
7 [label="Enter when branch result"];
2 [label="Enter block"];
3 [label="Exit block"];
}
subgraph cluster_3 {
color=blue
4 [label="Enter when"];
subgraph cluster_4 {
color=blue
8 [label="Enter block"];
9 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
10 [label="Exit block"];
5 [label="Enter when branch condition "];
6 [label="Const: Boolean(true)"];
7 [label="Exit when branch condition"];
}
11 [label="Exit when branch result"];
12 [label="Exit when"];
8 [label="Synthetic else branch"];
9 [label="Enter when branch result"];
subgraph cluster_5 {
color=blue
10 [label="Enter block"];
11 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
12 [label="Exit block"];
}
13 [label="Exit when branch result"];
14 [label="Exit when"];
}
13 [label="Exit block"];
15 [label="Exit block"];
}
14 [label="Exit function bar" style="filled" fillcolor=red];
16 [label="Exit function bar" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {7 6};
6 -> {12};
7 -> {8};
8 -> {9};
5 -> {6};
6 -> {7};
7 -> {9 8};
8 -> {14};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14};
subgraph cluster_5 {
color=red
15 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
16 [label="Enter block"];
17 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
18 [label="Postponed enter to lambda"];
subgraph cluster_7 {
color=blue
23 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
24 [label="Enter block"];
25 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
26 [label="Exit block"];
}
27 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
19 [label="Postponed exit from lambda"];
20 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
21 [label="Exit block"];
}
22 [label="Exit function foo" style="filled" fillcolor=red];
}
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19 23 20};
18 -> {23} [style=dashed];
19 -> {20};
20 -> {21};
21 -> {22};
23 -> {24};
24 -> {25};
subgraph cluster_6 {
color=red
25 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
26 [label="Enter block"];
subgraph cluster_8 {
color=blue
27 [label="Enter block"];
28 [label="Exit block"];
}
29 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
30 [label="Postponed enter to lambda"];
subgraph cluster_9 {
color=blue
35 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
36 [label="Enter block"];
37 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
38 [label="Exit block"];
}
39 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
31 [label="Postponed exit from lambda"];
32 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
33 [label="Exit block"];
}
34 [label="Exit function foo" style="filled" fillcolor=red];
}
25 -> {26};
26 -> {27};
27 -> {19};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31 35 32};
30 -> {35} [style=dashed];
31 -> {32};
32 -> {33};
33 -> {34};
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {31};
}
@@ -1,11 +1,17 @@
FILE: inPlaceLambda.kt
@R|kotlin/contracts/ExperimentalContracts|() public final fun bar(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun bar(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(x, AT_MOST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/x|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
}
)
}
when () {
Boolean(true) -> {
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
@@ -13,13 +19,19 @@ FILE: inPlaceLambda.kt
}
}
@R|kotlin/contracts/ExperimentalContracts|() public final fun foo(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun foo(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(x, AT_LEAST_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/x|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_LEAST_ONCE|)
}
)
}
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
R|/bar|(<L> = bar@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline, kind=AT_MOST_ONCE> {
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
@@ -1,7 +1,7 @@
// !DUMP_CFG
import kotlin.contracts.*
@ExperimentalContracts
@OptIn(ExperimentalContracts::class)
fun bar(x: () -> Unit) {
contract {
callsInPlace(x, InvocationKind.AT_MOST_ONCE)
@@ -12,7 +12,7 @@ fun bar(x: () -> Unit) {
}
}
@ExperimentalContracts
@OptIn(ExperimentalContracts::class)
fun foo(x: () -> Unit) {
contract {
callsInPlace(x, InvocationKind.AT_LEAST_ONCE)
@@ -9,62 +9,64 @@ digraph simple_kt {
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Access variable R|<local>/x|"];
3 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
4 [label="Exit block"];
subgraph cluster_2 {
color=blue
2 [label="Enter block"];
3 [label="Exit block"];
}
4 [label="Access variable R|<local>/x|"];
5 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
6 [label="Exit block"];
}
5 [label="Exit function bar" style="filled" fillcolor=red];
7 [label="Exit function bar" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
4 -> {5};
subgraph cluster_2 {
color=red
6 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
7 [label="Enter block"];
8 [label="Access variable R|<local>/x|"];
9 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
subgraph cluster_4 {
color=blue
10 [label="Enter when"];
subgraph cluster_5 {
color=blue
11 [label="Enter when branch condition "];
12 [label="Const: Boolean(true)"];
13 [label="Exit when branch condition"];
}
14 [label="Synthetic else branch"];
15 [label="Enter when branch result"];
subgraph cluster_6 {
color=blue
16 [label="Enter block"];
17 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
18 [label="Exit block"];
}
19 [label="Exit when branch result"];
20 [label="Exit when"];
}
21 [label="Access variable R|<local>/z|"];
22 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
23 [label="Exit block"];
}
24 [label="Exit function foo" style="filled" fillcolor=red];
}
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {15 14};
14 -> {20};
15 -> {16};
subgraph cluster_3 {
color=red
16 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
17 [label="Enter block"];
subgraph cluster_5 {
color=blue
18 [label="Enter block"];
19 [label="Exit block"];
}
20 [label="Access variable R|<local>/x|"];
21 [label="Function call: R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
subgraph cluster_6 {
color=blue
22 [label="Enter when"];
subgraph cluster_7 {
color=blue
23 [label="Enter when branch condition "];
24 [label="Const: Boolean(true)"];
25 [label="Exit when branch condition"];
}
26 [label="Synthetic else branch"];
27 [label="Enter when branch result"];
subgraph cluster_8 {
color=blue
28 [label="Enter block"];
29 [label="Function call: R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
30 [label="Exit block"];
}
31 [label="Exit when branch result"];
32 [label="Exit when"];
}
33 [label="Access variable R|<local>/z|"];
34 [label="Function call: R|/bar|(...)" style="filled" fillcolor=yellow];
35 [label="Exit block"];
}
36 [label="Exit function foo" style="filled" fillcolor=red];
}
16 -> {17};
17 -> {18};
18 -> {19};
@@ -73,5 +75,17 @@ digraph simple_kt {
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {27 26};
26 -> {32};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
}
@@ -1,14 +1,20 @@
FILE: simple.kt
@R|kotlin/contracts/ExperimentalContracts|() public final fun bar(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun bar(x: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(x, EXACTLY_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/x|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.EXACTLY_ONCE|)
}
)
}
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
@R|kotlin/contracts/ExperimentalContracts|() public final fun foo(x: R|() -> kotlin/Unit|, y: R|() -> kotlin/Unit|, z: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun foo(x: R|() -> kotlin/Unit|, y: R|() -> kotlin/Unit|, z: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(x, EXACTLY_ONCE)
@@ -16,7 +22,15 @@ FILE: simple.kt
CallsInPlace(z, EXACTLY_ONCE)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/x|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.EXACTLY_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/y|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.AT_MOST_ONCE|)
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/z|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.EXACTLY_ONCE|)
}
)
}
R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
when () {
Boolean(true) -> {
@@ -1,7 +1,7 @@
// !DUMP_CFG
import kotlin.contracts.*
@ExperimentalContracts
@OptIn(ExperimentalContracts::class)
fun bar(x: () -> Unit) {
contract {
callsInPlace(x, InvocationKind.EXACTLY_ONCE)
@@ -10,7 +10,7 @@ fun bar(x: () -> Unit) {
x.invoke()
}
@ExperimentalContracts
@OptIn(ExperimentalContracts::class)
fun foo(x: () -> Unit, y: () -> Unit, z: () -> Unit) {
contract {
callsInPlace(x, InvocationKind.EXACTLY_ONCE)
@@ -9,122 +9,136 @@ digraph unknown_kt {
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
3 [label="Exit block"];
subgraph cluster_2 {
color=blue
2 [label="Enter block"];
3 [label="Exit block"];
}
4 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
5 [label="Exit block"];
}
4 [label="Exit function inlineRun" style="filled" fillcolor=red];
6 [label="Exit function inlineRun" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {4};
subgraph cluster_2 {
color=red
5 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_3 {
color=blue
6 [label="Enter block"];
7 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
8 [label="Exit block"];
}
9 [label="Exit function myRun" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8};
8 -> {9};
subgraph cluster_4 {
subgraph cluster_3 {
color=red
10 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_5 {
15 [label="Enter function myRun" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
11 [label="Enter block"];
12 [label="Variable declaration: lval x: R|kotlin/Int|"];
13 [label="Postponed enter to lambda"];
subgraph cluster_6 {
16 [label="Enter block"];
subgraph cluster_5 {
color=blue
20 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
21 [label="Enter block"];
22 [label="Const: Int(1)"];
23 [label="Assignment: R|<local>/x|"];
24 [label="Exit block"];
}
25 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
17 [label="Enter block"];
18 [label="Exit block"];
}
14 [label="Postponed exit from lambda"];
15 [label="Function call: R|/inlineRun|(...)" style="filled" fillcolor=yellow];
16 [label="Access variable R|<local>/x|"];
17 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
18 [label="Exit block"];
19 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()" style="filled" fillcolor=yellow];
20 [label="Exit block"];
}
19 [label="Exit function test_1" style="filled" fillcolor=red];
21 [label="Exit function myRun" style="filled" fillcolor=red];
}
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14 20 15};
13 -> {20} [style=dashed];
14 -> {15};
14 -> {13} [color=green style=dashed];
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {14};
subgraph cluster_8 {
subgraph cluster_6 {
color=red
26 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_9 {
30 [label="Enter function test_1" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
27 [label="Enter block"];
28 [label="Variable declaration: lval x: R|kotlin/Int|"];
29 [label="Postponed enter to lambda"];
subgraph cluster_10 {
31 [label="Enter block"];
32 [label="Variable declaration: lval x: R|kotlin/Int|"];
33 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
36 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_11 {
40 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
37 [label="Enter block"];
38 [label="Const: Int(1)"];
39 [label="Assignment: R|<local>/x|"];
40 [label="Exit block"];
41 [label="Enter block"];
42 [label="Const: Int(1)"];
43 [label="Assignment: R|<local>/x|"];
44 [label="Exit block"];
}
41 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
45 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
30 [label="Postponed exit from lambda"];
31 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
32 [label="Access variable R|<local>/x|"];
33 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
34 [label="Exit block"];
34 [label="Postponed exit from lambda"];
35 [label="Function call: R|/inlineRun|(...)" style="filled" fillcolor=yellow];
36 [label="Access variable R|<local>/x|"];
37 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
38 [label="Exit block"];
}
35 [label="Exit function test_2" style="filled" fillcolor=red];
39 [label="Exit function test_1" style="filled" fillcolor=red];
}
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30 36 31};
29 -> {36} [style=dashed];
30 -> {31};
30 -> {29} [color=green style=dashed];
31 -> {32};
32 -> {33};
33 -> {34};
33 -> {34 40 35};
33 -> {40} [style=dashed];
34 -> {35};
34 -> {33} [color=green style=dashed];
35 -> {36};
36 -> {37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {30};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {34};
subgraph cluster_10 {
color=red
46 [label="Enter function test_2" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
47 [label="Enter block"];
48 [label="Variable declaration: lval x: R|kotlin/Int|"];
49 [label="Postponed enter to lambda"];
subgraph cluster_12 {
color=blue
56 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
57 [label="Enter block"];
58 [label="Const: Int(1)"];
59 [label="Assignment: R|<local>/x|"];
60 [label="Exit block"];
}
61 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
50 [label="Postponed exit from lambda"];
51 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
52 [label="Access variable R|<local>/x|"];
53 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()" style="filled" fillcolor=yellow];
54 [label="Exit block"];
}
55 [label="Exit function test_2" style="filled" fillcolor=red];
}
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50 56 51};
49 -> {56} [style=dashed];
50 -> {51};
50 -> {49} [color=green style=dashed];
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {50};
}
@@ -1,20 +1,32 @@
FILE: unknown.kt
public final inline fun inlineRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final inline fun inlineRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(block, UNKNOWN)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/block|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.UNKNOWN|)
}
)
}
R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun myRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun myRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit|
[R|Contract description]
<
CallsInPlace(block, UNKNOWN)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.callsInPlace|<R|kotlin/Unit|>(R|<local>/block|, Q|kotlin/contracts/InvocationKind|.R|kotlin/contracts/InvocationKind.UNKNOWN|)
}
)
}
R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
}
public final fun test_1(): R|kotlin/Unit| {
@@ -2,6 +2,7 @@
import kotlin.contracts.*
@OptIn(ExperimentalContracts::class)
inline fun inlineRun(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.UNKNOWN)
@@ -9,6 +10,7 @@ inline fun inlineRun(block: () -> Unit) {
block()
}
@OptIn(ExperimentalContracts::class)
fun myRun(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.UNKNOWN)
@@ -1,11 +1,17 @@
FILE: booleanOperators.kt
public final fun myRequire(b: R|kotlin/Boolean|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun myRequire(b: R|kotlin/Boolean|): R|kotlin/Unit|
[R|Contract description]
<
Returns(WILDCARD) -> b
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|().R|kotlin/contracts/SimpleEffect.implies|(R|<local>/b|)
}
)
}
when () {
R|<local>/b|.R|kotlin/Boolean.not|() -> {
throw R|java/lang/IllegalStateException.IllegalStateException|()
@@ -13,13 +19,19 @@ FILE: booleanOperators.kt
}
}
public final fun myRequireAnd(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun myRequireAnd(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit|
[R|Contract description]
<
Returns(WILDCARD) -> b1 && b2
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|().R|kotlin/contracts/SimpleEffect.implies|(R|<local>/b1| && R|<local>/b2|)
}
)
}
when () {
R|<local>/b1| && R|<local>/b2|.R|kotlin/Boolean.not|() -> {
throw R|java/lang/IllegalStateException.IllegalStateException|()
@@ -27,13 +39,19 @@ FILE: booleanOperators.kt
}
}
public final fun myRequireOr(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun myRequireOr(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit|
[R|Contract description]
<
Returns(WILDCARD) -> b1 || b2
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|().R|kotlin/contracts/SimpleEffect.implies|(R|<local>/b1| || R|<local>/b2|)
}
)
}
when () {
R|<local>/b1| || R|<local>/b2|.R|kotlin/Boolean.not|() -> {
throw R|java/lang/IllegalStateException.IllegalStateException|()
@@ -41,13 +59,19 @@ FILE: booleanOperators.kt
}
}
public final fun myRequireNot(b: R|kotlin/Boolean|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun myRequireNot(b: R|kotlin/Boolean|): R|kotlin/Unit|
[R|Contract description]
<
Returns(WILDCARD) -> !b
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|().R|kotlin/contracts/SimpleEffect.implies|(R|<local>/b|.R|kotlin/Boolean.not|())
}
)
}
when () {
R|<local>/b| -> {
throw R|java/lang/IllegalStateException.IllegalStateException|()
@@ -1,5 +1,6 @@
import kotlin.contracts.*
@OptIn(ExperimentalContracts::class)
fun myRequire(b: Boolean) {
contract {
returns() implies (b)
@@ -7,6 +8,7 @@ fun myRequire(b: Boolean) {
if (!b) throw IllegalStateException()
}
@OptIn(ExperimentalContracts::class)
fun myRequireAnd(b1: Boolean, b2: Boolean) {
contract {
returns() implies (b1 && b2)
@@ -14,6 +16,7 @@ fun myRequireAnd(b1: Boolean, b2: Boolean) {
if (!(b1 && b2)) throw IllegalStateException()
}
@OptIn(ExperimentalContracts::class)
fun myRequireOr(b1: Boolean, b2: Boolean) {
contract {
returns() implies (b1 || b2)
@@ -21,6 +24,7 @@ fun myRequireOr(b1: Boolean, b2: Boolean) {
if (!(b1 || b2)) throw IllegalStateException()
}
@OptIn(ExperimentalContracts::class)
fun myRequireNot(b: Boolean) {
contract {
returns() implies (!b)
@@ -5,25 +5,43 @@ FILE: conditionLogic.kt
Returns(NOT_NULL) -> !x == null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|(==(R|<local>/x|, Null(null)).R|kotlin/Boolean.not|())
}
)
}
^test1 R|<local>/x|
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test2(x: R|kotlin/String?|): R|kotlin/Any?|
[R|Contract description]
<
Returns(NOT_NULL) -> x is kotlin/String && x != null
Returns(NOT_NULL) -> x is kotlin/String
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/String|))
}
)
}
^test2 R|<local>/x|
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test3(x: R|kotlin/String?|): R|kotlin/Any?|
[R|Contract description]
<
Returns(NOT_NULL) -> x is kotlin/String? || x is kotlin/Any?
Returns(NOT_NULL) -> x !is kotlin/String
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| !is R|kotlin/String|))
}
)
}
^test3 R|<local>/x|
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test4(x: R|kotlin/String?|, y: R|kotlin/String?|): R|kotlin/Any?|
@@ -32,7 +50,13 @@ FILE: conditionLogic.kt
Returns(TRUE) -> x != null && y != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)) && !=(R|<local>/y|, Null(null)))
}
)
}
^test4 !=(R|<local>/x|, Null(null)) && !=(R|<local>/y|, Null(null))
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test5(x: R|kotlin/Any?|): R|kotlin/Any?|
@@ -41,7 +65,13 @@ FILE: conditionLogic.kt
Returns(TRUE) -> x != null || x is kotlin/Any
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)) || (R|<local>/x| is R|kotlin/Any|))
}
)
}
^test5 !=(R|<local>/x|, Null(null))
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test6(x: R|kotlin/Any?|): R|kotlin/Any?|
@@ -50,7 +80,13 @@ FILE: conditionLogic.kt
Returns(TRUE) -> x is kotlin/String? && x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/String?|) && !=(R|<local>/x|, Null(null)))
}
)
}
^test6 (R|<local>/x| is R|kotlin/String|)
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test7(x: R|kotlin/Any?|): R|kotlin/Any?|
@@ -59,7 +95,13 @@ FILE: conditionLogic.kt
Returns(TRUE) -> x is kotlin/String? && x != null || x is kotlin/Int
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/String?|) && !=(R|<local>/x|, Null(null)) || (R|<local>/x| is R|kotlin/Int|))
}
)
}
^test7 (R|<local>/x| is R|kotlin/String|)
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test8(x: R|kotlin/Any?|): R|kotlin/Any?|
@@ -68,7 +110,13 @@ FILE: conditionLogic.kt
Returns(TRUE) -> x is kotlin/String || x is kotlin/Int
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/String|) || (R|<local>/x| is R|kotlin/Int|))
}
)
}
^test8 (R|<local>/x| is R|kotlin/String|) || (R|<local>/x| is R|kotlin/Int|)
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test9(x: R|kotlin/Any?|): R|kotlin/Any?|
@@ -77,7 +125,13 @@ FILE: conditionLogic.kt
Returns(TRUE) -> x is kotlin/String || x is kotlin/Int
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/String|) || (R|<local>/x| is R|kotlin/Int|))
}
)
}
when () {
(R|<local>/x| is R|kotlin/String|) -> {
^test9 Boolean(true)
@@ -92,7 +146,13 @@ FILE: conditionLogic.kt
Returns(TRUE) -> x is kotlin/Comparable<*> || x is kotlin/CharSequence
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/Comparable<*>|) || (R|<local>/x| is R|kotlin/CharSequence|))
}
)
}
^test10 (R|<local>/x| is R|kotlin/String|)
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test11(x: R|kotlin/Any?|): R|kotlin/Any?|
@@ -101,7 +161,13 @@ FILE: conditionLogic.kt
Returns(TRUE) -> x is kotlin/Comparable<*> && x is kotlin/CharSequence
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/Comparable<*>|) && (R|<local>/x| is R|kotlin/CharSequence|))
}
)
}
^test11 (R|<local>/x| is R|kotlin/String|)
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test12(x: R|kotlin/Any?|): R|kotlin/Any?|
@@ -110,7 +176,13 @@ FILE: conditionLogic.kt
Returns(TRUE) -> x is kotlin/Comparable<*> && x is kotlin/CharSequence || x is kotlin/Number
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/Comparable<*>|) && (R|<local>/x| is R|kotlin/CharSequence|) || (R|<local>/x| is R|kotlin/Number|))
}
)
}
^test12 (R|<local>/x| is R|kotlin/String|) || (R|<local>/x| is R|kotlin/Int|)
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test13(x: R|kotlin/Any?|): R|kotlin/Any?|
@@ -119,6 +191,12 @@ FILE: conditionLogic.kt
Returns(TRUE) -> (!)x !is kotlin/Comparable<*> || x !is kotlin/CharSequence && (!x is kotlin/Number)
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| !is R|kotlin/Comparable<*>|) || (R|<local>/x| !is R|kotlin/CharSequence|) && (R|<local>/x| is R|kotlin/Number|).R|kotlin/Boolean.not|().R|kotlin/Boolean.not|())
}
)
}
^test13 (R|<local>/x| is R|kotlin/String|) || (R|<local>/x| is R|kotlin/Int|)
}
@@ -13,7 +13,7 @@ fun test1(x: String?): Any? {
@OptIn(ExperimentalContracts::class)
fun test2(x: String?): Any? {
contract {
returnsNotNull() implies (x is String && x != null)
returnsNotNull() implies (x is String)
}
return x
@@ -22,7 +22,7 @@ fun test2(x: String?): Any? {
@OptIn(ExperimentalContracts::class)
fun test3(x: String?): Any? {
contract {
returnsNotNull() implies (x is String? || x is Any?)
returnsNotNull() implies (x !is String)
}
return x
@@ -1,21 +1,34 @@
FILE: eqNotEq.kt
public final fun checkNotNull(x: R|kotlin/Any?|): R|kotlin/Boolean|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun checkNotNull(x: R|kotlin/Any?|): R|kotlin/Boolean|
[R|Contract description]
<
Returns(TRUE) -> x != null
Returns(FALSE) -> x == null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(false)).R|kotlin/contracts/SimpleEffect.implies|(==(R|<local>/x|, Null(null)))
}
)
}
^checkNotNull !=(R|<local>/x|, Null(null))
}
public final fun trickyRequireNotNull(x: R|kotlin/Any?|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun trickyRequireNotNull(x: R|kotlin/Any?|): R|kotlin/Unit|
[R|Contract description]
<
Returns(WILDCARD) -> !x == null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|().R|kotlin/contracts/SimpleEffect.implies|(==(R|<local>/x|, Null(null)).R|kotlin/Boolean.not|())
}
)
}
when () {
==(R|<local>/x|, Null(null)) -> {
throw R|java/lang/IllegalStateException.IllegalStateException|()
@@ -1,5 +1,6 @@
import kotlin.contracts.*
@OptIn(ExperimentalContracts::class)
fun checkNotNull(x: Any?): Boolean {
contract {
returns(true) implies (x != null)
@@ -8,6 +9,7 @@ fun checkNotNull(x: Any?): Boolean {
return x != null
}
@OptIn(ExperimentalContracts::class)
fun trickyRequireNotNull(x: Any?) {
contract {
returns() implies (!(x == null))
@@ -5,7 +5,13 @@ FILE: inapplicable.kt
Returns(FALSE) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(false)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^wrongFalse Boolean(true)
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun wrongTrue(x: R|kotlin/String?|): R|kotlin/Boolean|
@@ -14,7 +20,13 @@ FILE: inapplicable.kt
Returns(TRUE) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^wrongTrue Boolean(false)
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun nullableConstant(x: R|kotlin/String?|): R|kotlin/Any?|
@@ -23,7 +35,13 @@ FILE: inapplicable.kt
Returns(NULL) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Null(null)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^nullableConstant Int(1)
}
public final fun string(): R|kotlin/String| {
@@ -35,7 +53,13 @@ FILE: inapplicable.kt
Returns(NULL) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Null(null)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^nullableReturn R|/string|()
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun returnsNull(x: R|kotlin/String?|): R|kotlin/Any?|
@@ -44,7 +68,13 @@ FILE: inapplicable.kt
Returns(NOT_NULL) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^returnsNull Null(null)
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun wrongReturnType(x: R|kotlin/String?|): R|kotlin/Any?|
@@ -53,6 +83,12 @@ FILE: inapplicable.kt
Returns(TRUE) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^wrongReturnType String(true)
}
@@ -1,11 +1,17 @@
FILE: namedArguments.kt
public final fun foo(x: R|kotlin/Any|, y: R|kotlin/Any|): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun foo(x: R|kotlin/Any|, y: R|kotlin/Any|): R|kotlin/Unit|
[R|Contract description]
<
Returns(WILDCARD) -> x is kotlin/Int && y is kotlin/String
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|().R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/Int|) && (R|<local>/y| is R|kotlin/String|))
}
)
}
when () {
(R|<local>/x| !is R|kotlin/Int|) || (R|<local>/y| !is R|kotlin/String|) -> {
throw R|java/lang/IllegalStateException.IllegalStateException|()
@@ -1,5 +1,6 @@
import kotlin.contracts.*
@OptIn(ExperimentalContracts::class)
fun foo(x: Any, y: Any) {
contract {
returns() implies (x is Int && y is String)
@@ -5,7 +5,13 @@ FILE: notNull.kt
Returns(FALSE) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(false)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^test1 ==(R|<local>/x|, Null(null))
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test2(x: R|kotlin/String?|): R|kotlin/Boolean|
@@ -14,7 +20,13 @@ FILE: notNull.kt
Returns(TRUE) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^test2 !=(R|<local>/x|, Null(null))
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test3(x: R|kotlin/String?|): R|kotlin/Any?|
@@ -23,7 +35,13 @@ FILE: notNull.kt
Returns(TRUE) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
when () {
!=(R|<local>/x|, Null(null)) -> {
^test3 Boolean(true)
@@ -38,7 +56,13 @@ FILE: notNull.kt
Returns(TRUE) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
lval y: R|kotlin/String?| = R|<local>/x|
when () {
!=(R|<local>/y|, Null(null)) -> {
@@ -54,6 +78,12 @@ FILE: notNull.kt
Returns(TRUE) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^test5 R|/test2|(R|<local>/x|)
}
@@ -3,14 +3,20 @@ FILE: propertyAccessors.kt
public abstract fun foo(): R|kotlin/Unit|
}
public final var R|kotlin/Any?|.isNotNull: R|kotlin/Boolean|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final var R|kotlin/Any?|.isNotNull: R|kotlin/Boolean|
public get(): R|kotlin/Boolean|
[R|Contract description]
<
Returns(TRUE) -> this != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(this@R|/isNotNull|, Null(null)))
}
)
}
^ !=(this@R|/isNotNull|, Null(null))
}
public set(value: R|kotlin/Boolean|): R|kotlin/Unit|
@@ -19,7 +25,14 @@ FILE: propertyAccessors.kt
Returns(WILDCARD) -> this != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|().R|kotlin/contracts/SimpleEffect.implies|(!=(this@R|/isNotNull|, Null(null)))
R|kotlin/require|(!=(this@R|special/anonymous|, Null(null)))
}
)
}
}
public final fun test_1(a: R|A?|): R|kotlin/Unit| {
when () {
@@ -4,6 +4,7 @@ interface A {
fun foo()
}
@OptIn(ExperimentalContracts::class)
var Any?.isNotNull: Boolean
get() {
contract {
@@ -3,13 +3,19 @@ FILE: receivers.kt
}
public final fun R|A|.foo(): R|kotlin/Unit| {
}
public final fun R|kotlin/Any?|.myRequireNotNull(): R|kotlin/Unit|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun R|kotlin/Any?|.myRequireNotNull(): R|kotlin/Unit|
[R|Contract description]
<
Returns(WILDCARD) -> this != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|().R|kotlin/contracts/SimpleEffect.implies|(!=(this@R|/myRequireNotNull|, Null(null)))
}
)
}
when () {
==(this@R|/myRequireNotNull|, Null(null)) -> {
throw R|java/lang/IllegalStateException.IllegalStateException|()
@@ -4,6 +4,7 @@ interface A
fun A.foo() {}
@OptIn(ExperimentalContracts::class)
fun Any?.myRequireNotNull() {
contract {
returns() implies (this@myRequireNotNull != null)
@@ -5,7 +5,13 @@ FILE: safeCall.kt
Returns(NOT_NULL) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^test1 R|<local>/x|?.{ $subj$.R|kotlin/String.length| }
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test2(x: R|kotlin/String?|): R|kotlin/Int?|
@@ -14,6 +20,12 @@ FILE: safeCall.kt
Returns(NOT_NULL) -> x is kotlin/Boolean
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/Boolean|))
}
)
}
^test2 R|<local>/x|?.{ $subj$.R|kotlin/String.length| }
}
@@ -5,7 +5,13 @@ FILE: trickyCases.kt
Returns(NOT_NULL) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^test1 R|<local>/x|
}
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun test2(x: R|kotlin/String?|): R|kotlin/Any?|
@@ -14,7 +20,13 @@ FILE: trickyCases.kt
Returns(TRUE) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^test2 when () {
!=(R|<local>/x|, Null(null)) -> {
Boolean(true)
@@ -31,7 +43,13 @@ FILE: trickyCases.kt
Returns(NOT_NULL) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^test3 when () {
Boolean(true) -> {
R|<local>/x|
@@ -48,7 +66,13 @@ FILE: trickyCases.kt
Returns(NOT_NULL) -> x != null
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returnsNotNull|().R|kotlin/contracts/SimpleEffect.implies|(!=(R|<local>/x|, Null(null)))
}
)
}
^test4 when () {
!=(R|<local>/x|, Null(null)) -> {
when () {
@@ -1,12 +1,19 @@
FILE: typePredicate.kt
public final fun checkIsString(x: R|kotlin/Any|): R|kotlin/Boolean|
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun checkIsString(x: R|kotlin/Any|): R|kotlin/Boolean|
[R|Contract description]
<
Returns(TRUE) -> x is kotlin/String
Returns(FALSE) -> x !is kotlin/String
>
{
[StubStatement]
{
R|kotlin/contracts/contract|(<L> = contract@fun R|kotlin/contracts/ContractBuilder|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN> {
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(true)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| is R|kotlin/String|))
this@R|special/anonymous|.R|kotlin/contracts/ContractBuilder.returns|(Boolean(false)).R|kotlin/contracts/SimpleEffect.implies|((R|<local>/x| !is R|kotlin/String|))
}
)
}
^checkIsString (R|<local>/x| is R|kotlin/String|)
}
public final fun test(x: R|kotlin/Any|): R|kotlin/Unit| {
@@ -1,5 +1,6 @@
import kotlin.contracts.*
@OptIn(ExperimentalContracts::class)
fun checkIsString(x: Any): Boolean {
contract {
returns(true) implies (x is String)