[FIR] Approximate statements with ILT without expected type
This commit is contained in:
+8
-1
@@ -188,7 +188,14 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
|
|||||||
val value = if (index == numberOfStatements - 1) data else ResolutionMode.ContextIndependent
|
val value = if (index == numberOfStatements - 1) data else ResolutionMode.ContextIndependent
|
||||||
TransformData.Data(value)
|
TransformData.Data(value)
|
||||||
}
|
}
|
||||||
block.transformAllStatementsExceptLast(integerLiteralTypeApproximator, builtinTypes.intType.type)
|
if (data == ResolutionMode.ContextIndependent) {
|
||||||
|
block.transformStatements(integerLiteralTypeApproximator, null)
|
||||||
|
} else {
|
||||||
|
block.transformAllStatementsExceptLast(
|
||||||
|
integerLiteralTypeApproximator,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
block.transformOtherChildren(transformer, data)
|
block.transformOtherChildren(transformer, data)
|
||||||
|
|
||||||
val resultExpression = when (val statement = block.statements.lastOrNull()) {
|
val resultExpression = when (val statement = block.statements.lastOrNull()) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ digraph binaryOperations_kt {
|
|||||||
subgraph cluster_4 {
|
subgraph cluster_4 {
|
||||||
color=blue
|
color=blue
|
||||||
12 [label="Enter block"];
|
12 [label="Enter block"];
|
||||||
13 [label="Const: IntegerLiteral(1)"];
|
13 [label="Const: Int(1)"];
|
||||||
14 [label="Exit block"];
|
14 [label="Exit block"];
|
||||||
}
|
}
|
||||||
15 [label="Exit when branch result"];
|
15 [label="Exit when branch result"];
|
||||||
@@ -80,7 +80,7 @@ digraph binaryOperations_kt {
|
|||||||
subgraph cluster_9 {
|
subgraph cluster_9 {
|
||||||
color=blue
|
color=blue
|
||||||
30 [label="Enter block"];
|
30 [label="Enter block"];
|
||||||
31 [label="Const: IntegerLiteral(1)"];
|
31 [label="Const: Int(1)"];
|
||||||
32 [label="Exit block"];
|
32 [label="Exit block"];
|
||||||
}
|
}
|
||||||
33 [label="Exit when branch result"];
|
33 [label="Exit when branch result"];
|
||||||
@@ -140,7 +140,7 @@ digraph binaryOperations_kt {
|
|||||||
subgraph cluster_15 {
|
subgraph cluster_15 {
|
||||||
color=blue
|
color=blue
|
||||||
53 [label="Enter block"];
|
53 [label="Enter block"];
|
||||||
54 [label="Const: IntegerLiteral(1)"];
|
54 [label="Const: Int(1)"];
|
||||||
55 [label="Exit block"];
|
55 [label="Exit block"];
|
||||||
}
|
}
|
||||||
56 [label="Exit when branch result"];
|
56 [label="Exit when branch result"];
|
||||||
@@ -205,7 +205,7 @@ digraph binaryOperations_kt {
|
|||||||
subgraph cluster_21 {
|
subgraph cluster_21 {
|
||||||
color=blue
|
color=blue
|
||||||
76 [label="Enter block"];
|
76 [label="Enter block"];
|
||||||
77 [label="Const: IntegerLiteral(1)"];
|
77 [label="Const: Int(1)"];
|
||||||
78 [label="Exit block"];
|
78 [label="Exit block"];
|
||||||
}
|
}
|
||||||
79 [label="Exit when branch result"];
|
79 [label="Exit when branch result"];
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ FILE: binaryOperations.kt
|
|||||||
public final fun test_1(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_1(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
R|<local>/b1| || R|<local>/b2| -> {
|
R|<local>/b1| || R|<local>/b2| -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ FILE: binaryOperations.kt
|
|||||||
public final fun test_2(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_2(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
R|<local>/b1| && R|<local>/b2| -> {
|
R|<local>/b1| && R|<local>/b2| -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ FILE: binaryOperations.kt
|
|||||||
public final fun test_3(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|, b3: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_3(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|, b3: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
R|<local>/b1| && R|<local>/b2| || R|<local>/b3| -> {
|
R|<local>/b1| && R|<local>/b2| || R|<local>/b3| -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ FILE: binaryOperations.kt
|
|||||||
public final fun test_4(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|, b3: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_4(b1: R|kotlin/Boolean|, b2: R|kotlin/Boolean|, b3: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
R|<local>/b1| || R|<local>/b2| && R|<local>/b3| -> {
|
R|<local>/b1| || R|<local>/b2| && R|<local>/b3| -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ digraph booleanOperatorsWithConsts_kt {
|
|||||||
subgraph cluster_4 {
|
subgraph cluster_4 {
|
||||||
color=blue
|
color=blue
|
||||||
12 [label="Enter block"];
|
12 [label="Enter block"];
|
||||||
13 [label="Const: IntegerLiteral(1)"];
|
13 [label="Const: Int(1)"];
|
||||||
14 [label="Exit block"];
|
14 [label="Exit block"];
|
||||||
}
|
}
|
||||||
15 [label="Exit when branch result"];
|
15 [label="Exit when branch result"];
|
||||||
@@ -80,7 +80,7 @@ digraph booleanOperatorsWithConsts_kt {
|
|||||||
subgraph cluster_9 {
|
subgraph cluster_9 {
|
||||||
color=blue
|
color=blue
|
||||||
30 [label="Enter block"];
|
30 [label="Enter block"];
|
||||||
31 [label="Const: IntegerLiteral(1)"];
|
31 [label="Const: Int(1)"];
|
||||||
32 [label="Exit block"];
|
32 [label="Exit block"];
|
||||||
}
|
}
|
||||||
33 [label="Exit when branch result"];
|
33 [label="Exit when branch result"];
|
||||||
@@ -133,7 +133,7 @@ digraph booleanOperatorsWithConsts_kt {
|
|||||||
subgraph cluster_14 {
|
subgraph cluster_14 {
|
||||||
color=blue
|
color=blue
|
||||||
48 [label="Enter block"];
|
48 [label="Enter block"];
|
||||||
49 [label="Const: IntegerLiteral(1)"];
|
49 [label="Const: Int(1)"];
|
||||||
50 [label="Exit block"];
|
50 [label="Exit block"];
|
||||||
}
|
}
|
||||||
51 [label="Exit when branch result"];
|
51 [label="Exit when branch result"];
|
||||||
@@ -185,7 +185,7 @@ digraph booleanOperatorsWithConsts_kt {
|
|||||||
subgraph cluster_19 {
|
subgraph cluster_19 {
|
||||||
color=blue
|
color=blue
|
||||||
66 [label="Enter block"];
|
66 [label="Enter block"];
|
||||||
67 [label="Const: IntegerLiteral(1)"];
|
67 [label="Const: Int(1)"];
|
||||||
68 [label="Exit block"];
|
68 [label="Exit block"];
|
||||||
}
|
}
|
||||||
69 [label="Exit when branch result"];
|
69 [label="Exit when branch result"];
|
||||||
@@ -238,7 +238,7 @@ digraph booleanOperatorsWithConsts_kt {
|
|||||||
subgraph cluster_24 {
|
subgraph cluster_24 {
|
||||||
color=blue
|
color=blue
|
||||||
84 [label="Enter block"];
|
84 [label="Enter block"];
|
||||||
85 [label="Const: IntegerLiteral(1)"];
|
85 [label="Const: Int(1)"];
|
||||||
86 [label="Exit block"];
|
86 [label="Exit block"];
|
||||||
}
|
}
|
||||||
87 [label="Exit when branch result"];
|
87 [label="Exit when branch result"];
|
||||||
@@ -290,7 +290,7 @@ digraph booleanOperatorsWithConsts_kt {
|
|||||||
subgraph cluster_29 {
|
subgraph cluster_29 {
|
||||||
color=blue
|
color=blue
|
||||||
102 [label="Enter block"];
|
102 [label="Enter block"];
|
||||||
103 [label="Const: IntegerLiteral(1)"];
|
103 [label="Const: Int(1)"];
|
||||||
104 [label="Exit block"];
|
104 [label="Exit block"];
|
||||||
}
|
}
|
||||||
105 [label="Exit when branch result"];
|
105 [label="Exit when branch result"];
|
||||||
@@ -343,7 +343,7 @@ digraph booleanOperatorsWithConsts_kt {
|
|||||||
subgraph cluster_34 {
|
subgraph cluster_34 {
|
||||||
color=blue
|
color=blue
|
||||||
120 [label="Enter block"];
|
120 [label="Enter block"];
|
||||||
121 [label="Const: IntegerLiteral(1)"];
|
121 [label="Const: Int(1)"];
|
||||||
122 [label="Exit block"];
|
122 [label="Exit block"];
|
||||||
}
|
}
|
||||||
123 [label="Exit when branch result"];
|
123 [label="Exit when branch result"];
|
||||||
@@ -395,7 +395,7 @@ digraph booleanOperatorsWithConsts_kt {
|
|||||||
subgraph cluster_39 {
|
subgraph cluster_39 {
|
||||||
color=blue
|
color=blue
|
||||||
138 [label="Enter block"];
|
138 [label="Enter block"];
|
||||||
139 [label="Const: IntegerLiteral(1)"];
|
139 [label="Const: Int(1)"];
|
||||||
140 [label="Exit block"];
|
140 [label="Exit block"];
|
||||||
}
|
}
|
||||||
141 [label="Exit when branch result"];
|
141 [label="Exit when branch result"];
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ FILE: booleanOperatorsWithConsts.kt
|
|||||||
public final fun test_1(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_1(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
R|<local>/b| || Boolean(false) -> {
|
R|<local>/b| || Boolean(false) -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ FILE: booleanOperatorsWithConsts.kt
|
|||||||
public final fun test_2(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_2(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
Boolean(false) || R|<local>/b| -> {
|
Boolean(false) || R|<local>/b| -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ FILE: booleanOperatorsWithConsts.kt
|
|||||||
public final fun test_3(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_3(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
R|<local>/b| || Boolean(true) -> {
|
R|<local>/b| || Boolean(true) -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ FILE: booleanOperatorsWithConsts.kt
|
|||||||
public final fun test_4(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_4(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
Boolean(true) || R|<local>/b| -> {
|
Boolean(true) || R|<local>/b| -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ FILE: booleanOperatorsWithConsts.kt
|
|||||||
public final fun test_5(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_5(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
R|<local>/b| && Boolean(false) -> {
|
R|<local>/b| && Boolean(false) -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ FILE: booleanOperatorsWithConsts.kt
|
|||||||
public final fun test_6(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_6(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
Boolean(false) && R|<local>/b| -> {
|
Boolean(false) && R|<local>/b| -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ FILE: booleanOperatorsWithConsts.kt
|
|||||||
public final fun test_7(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_7(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
R|<local>/b| && Boolean(true) -> {
|
R|<local>/b| && Boolean(true) -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ FILE: booleanOperatorsWithConsts.kt
|
|||||||
public final fun test_8(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_8(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
when () {
|
when () {
|
||||||
Boolean(true) && R|<local>/b| -> {
|
Boolean(true) && R|<local>/b| -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -183,7 +183,7 @@ digraph loops_kt {
|
|||||||
subgraph cluster_19 {
|
subgraph cluster_19 {
|
||||||
color=blue
|
color=blue
|
||||||
63 [label="Enter block"];
|
63 [label="Enter block"];
|
||||||
64 [label="Const: IntegerLiteral(1)"];
|
64 [label="Const: Int(1)"];
|
||||||
65 [label="Exit block"];
|
65 [label="Exit block"];
|
||||||
}
|
}
|
||||||
66 [label="Exit loop block"];
|
66 [label="Exit loop block"];
|
||||||
@@ -301,7 +301,7 @@ digraph loops_kt {
|
|||||||
subgraph cluster_32 {
|
subgraph cluster_32 {
|
||||||
color=blue
|
color=blue
|
||||||
100 [label="Enter block" style="filled" fillcolor=gray];
|
100 [label="Enter block" style="filled" fillcolor=gray];
|
||||||
101 [label="Const: IntegerLiteral(1)" style="filled" fillcolor=gray];
|
101 [label="Const: Int(1)" style="filled" fillcolor=gray];
|
||||||
102 [label="Exit block" style="filled" fillcolor=gray];
|
102 [label="Exit block" style="filled" fillcolor=gray];
|
||||||
}
|
}
|
||||||
103 [label="Exit loop block" style="filled" fillcolor=gray];
|
103 [label="Exit loop block" style="filled" fillcolor=gray];
|
||||||
@@ -338,7 +338,7 @@ digraph loops_kt {
|
|||||||
subgraph cluster_36 {
|
subgraph cluster_36 {
|
||||||
color=blue
|
color=blue
|
||||||
110 [label="Enter block"];
|
110 [label="Enter block"];
|
||||||
111 [label="Const: IntegerLiteral(1)"];
|
111 [label="Const: Int(1)"];
|
||||||
112 [label="Exit block"];
|
112 [label="Exit block"];
|
||||||
}
|
}
|
||||||
113 [label="Exit loop block"];
|
113 [label="Exit loop block"];
|
||||||
@@ -456,7 +456,7 @@ digraph loops_kt {
|
|||||||
subgraph cluster_49 {
|
subgraph cluster_49 {
|
||||||
color=blue
|
color=blue
|
||||||
147 [label="Enter block"];
|
147 [label="Enter block"];
|
||||||
148 [label="Const: IntegerLiteral(1)"];
|
148 [label="Const: Int(1)"];
|
||||||
149 [label="Exit block"];
|
149 [label="Exit block"];
|
||||||
}
|
}
|
||||||
150 [label="Exit loop block"];
|
150 [label="Exit loop block"];
|
||||||
|
|||||||
+4
-4
@@ -24,7 +24,7 @@ FILE: loops.kt
|
|||||||
}
|
}
|
||||||
public final fun testWhileTrue(): R|kotlin/Unit| {
|
public final fun testWhileTrue(): R|kotlin/Unit| {
|
||||||
while(Boolean(true)) {
|
while(Boolean(true)) {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
Int(1)
|
Int(1)
|
||||||
@@ -43,14 +43,14 @@ FILE: loops.kt
|
|||||||
}
|
}
|
||||||
public final fun testWhileFalse(): R|kotlin/Unit| {
|
public final fun testWhileFalse(): R|kotlin/Unit| {
|
||||||
while(Boolean(false)) {
|
while(Boolean(false)) {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
Int(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
public final fun testDoWhileTrue(): R|kotlin/Unit| {
|
public final fun testDoWhileTrue(): R|kotlin/Unit| {
|
||||||
do {
|
do {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
while(Boolean(true))
|
while(Boolean(true))
|
||||||
Int(1)
|
Int(1)
|
||||||
@@ -69,7 +69,7 @@ FILE: loops.kt
|
|||||||
}
|
}
|
||||||
public final fun testDoWhileFalse(): R|kotlin/Unit| {
|
public final fun testDoWhileFalse(): R|kotlin/Unit| {
|
||||||
do {
|
do {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
while(Boolean(false))
|
while(Boolean(false))
|
||||||
Int(1)
|
Int(1)
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ digraph propertiesAndInitBlocks_kt {
|
|||||||
subgraph cluster_18 {
|
subgraph cluster_18 {
|
||||||
color=blue
|
color=blue
|
||||||
57 [label="Enter block"];
|
57 [label="Enter block"];
|
||||||
58 [label="Const: IntegerLiteral(0)"];
|
58 [label="Const: Int(0)"];
|
||||||
59 [label="Exit block"];
|
59 [label="Exit block"];
|
||||||
}
|
}
|
||||||
60 [label="Exit finally"];
|
60 [label="Exit finally"];
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ FILE: propertiesAndInitBlocks.kt
|
|||||||
Int(2)
|
Int(2)
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
IntegerLiteral(0)
|
Int(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
public get(): R|kotlin/Int|
|
public get(): R|kotlin/Int|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ FILE: exhaustiveness_boolean.kt
|
|||||||
public final fun test_1(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
public final fun test_1(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||||
lval x: R|kotlin/Unit| = when (R|<local>/b|) {
|
lval x: R|kotlin/Unit| = when (R|<local>/b|) {
|
||||||
==($subj$, Boolean(true)) -> {
|
==($subj$, Boolean(true)) -> {
|
||||||
IntegerLiteral(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user