[FIR] Try to infer result type of incomplete when expression
^KT-62069 Fixed
This commit is contained in:
committed by
Space Team
parent
e2f245096c
commit
88f7b085e6
Vendored
+3
-3
@@ -1,12 +1,12 @@
|
||||
FILE: missingBooleanBranch.kt
|
||||
public final fun test_1(cond: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/cond|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/cond|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
lval y: R|kotlin/Unit| = when (R|<local>/cond|) {
|
||||
lval y: R|kotlin/Int| = when (R|<local>/cond|) {
|
||||
==($subj$, Boolean(false)) -> {
|
||||
Int(2)
|
||||
}
|
||||
@@ -23,7 +23,7 @@ FILE: missingBooleanBranch.kt
|
||||
|
||||
}
|
||||
public final fun test_2(cond: R|kotlin/Boolean?|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/cond|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/cond|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
FILE: missingElse.kt
|
||||
public final fun test(a: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/a|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/a|) {
|
||||
($subj$ is R|kotlin/Int|) -> {
|
||||
Int(1)
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -17,7 +17,7 @@ FILE: missingEnumEntry.kt
|
||||
|
||||
}
|
||||
public final fun test_1(enum: R|SomeEnum|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/enum|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/enum|) {
|
||||
==($subj$, Q|SomeEnum|.R|/SomeEnum.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -34,7 +34,7 @@ FILE: missingEnumEntry.kt
|
||||
|
||||
}
|
||||
public final fun test_2(enum: R|SomeEnum?|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/enum|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/enum|) {
|
||||
==($subj$, Q|SomeEnum|.R|/SomeEnum.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -20,13 +20,13 @@ FILE: b.kt
|
||||
}
|
||||
FILE: c.kt
|
||||
public final fun test_1(base: R|Base|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/base|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/base|) {
|
||||
($subj$ is R|A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
lval y: R|kotlin/Unit| = when (R|<local>/base|) {
|
||||
lval y: R|kotlin/Int| = when (R|<local>/base|) {
|
||||
==($subj$, Q|B|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -43,7 +43,7 @@ FILE: c.kt
|
||||
|
||||
}
|
||||
public final fun test_2(base: R|Base?|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/base|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/base|) {
|
||||
($subj$ is R|A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -52,7 +52,7 @@ FILE: c.kt
|
||||
}
|
||||
}
|
||||
|
||||
lval y: R|kotlin/Unit| = when (R|<local>/base|) {
|
||||
lval y: R|kotlin/Int| = when (R|<local>/base|) {
|
||||
($subj$ is R|A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
FILE: exhaustiveness_boolean.kt
|
||||
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/Int| = when (R|<local>/b|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -26,7 +26,7 @@ FILE: exhaustiveness_boolean.kt
|
||||
|
||||
}
|
||||
public final fun test_2(b: R|kotlin/Boolean?|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/b|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/b|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -18,7 +18,7 @@ FILE: exhaustiveness_enum.kt
|
||||
|
||||
}
|
||||
public final fun test_1(e: R|Enum|): R|kotlin/Unit| {
|
||||
lval a: R|kotlin/Unit| = when (R|<local>/e|) {
|
||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -27,7 +27,7 @@ FILE: exhaustiveness_enum.kt
|
||||
}
|
||||
}
|
||||
|
||||
lval b: R|kotlin/Unit| = when (R|<local>/e|) {
|
||||
lval b: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -62,7 +62,7 @@ FILE: exhaustiveness_enum.kt
|
||||
|
||||
}
|
||||
public final fun test_2(e: R|Enum?|): R|kotlin/Unit| {
|
||||
lval a: R|kotlin/Unit| = when (R|<local>/e|) {
|
||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
|
||||
compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_enumJava.fir.txt
Vendored
+6
-6
@@ -1,6 +1,6 @@
|
||||
FILE: main.kt
|
||||
public final fun test_1(e: R|JavaEnum|): R|kotlin/Unit| {
|
||||
lval a: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
|
||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
==($subj$, Q|JavaEnum|.R|/JavaEnum.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -8,8 +8,8 @@ FILE: main.kt
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
.<Unresolved name: plus>#(Int(0))
|
||||
lval b: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
|
||||
.R|kotlin/Int.plus|(Int(0))
|
||||
lval b: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
==($subj$, Q|JavaEnum|.R|/JavaEnum.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -20,7 +20,7 @@ FILE: main.kt
|
||||
Int(3)
|
||||
}
|
||||
}
|
||||
.<Unresolved name: plus>#(Int(0))
|
||||
.R|kotlin/Int.plus|(Int(0))
|
||||
lval c: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
==($subj$, Q|JavaEnum|.R|/JavaEnum.A|) -> {
|
||||
Int(1)
|
||||
@@ -44,7 +44,7 @@ FILE: main.kt
|
||||
.R|kotlin/Int.plus|(Int(0))
|
||||
}
|
||||
public final fun test_2(e: R|JavaEnum?|): R|kotlin/Unit| {
|
||||
lval a: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
|
||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
==($subj$, Q|JavaEnum|.R|/JavaEnum.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -55,7 +55,7 @@ FILE: main.kt
|
||||
Int(3)
|
||||
}
|
||||
}
|
||||
.<Unresolved name: plus>#(Int(0))
|
||||
.R|kotlin/Int.plus|(Int(0))
|
||||
lval b: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
==($subj$, Q|JavaEnum|.R|/JavaEnum.A|) -> {
|
||||
Int(1)
|
||||
|
||||
Vendored
+3
-3
@@ -10,13 +10,13 @@ fun test_1(e: JavaEnum) {
|
||||
val a = <!NO_ELSE_IN_WHEN!>when<!> (e) {
|
||||
JavaEnum.A -> 1
|
||||
JavaEnum.B -> 2
|
||||
}.<!UNRESOLVED_REFERENCE!>plus<!>(0)
|
||||
}.plus(0)
|
||||
|
||||
val b = <!NO_ELSE_IN_WHEN!>when<!> (e) {
|
||||
JavaEnum.A -> 1
|
||||
JavaEnum.B -> 2
|
||||
is String -> 3
|
||||
}.<!UNRESOLVED_REFERENCE!>plus<!>(0)
|
||||
}.plus(0)
|
||||
|
||||
val c = when (e) {
|
||||
JavaEnum.A -> 1
|
||||
@@ -35,7 +35,7 @@ fun test_2(e: JavaEnum?) {
|
||||
JavaEnum.A -> 1
|
||||
JavaEnum.B -> 2
|
||||
JavaEnum.C -> 3
|
||||
}.<!UNRESOLVED_REFERENCE!>plus<!>(0)
|
||||
}.plus(0)
|
||||
|
||||
val b = when (e) {
|
||||
JavaEnum.A -> 1
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@ FILE: exhaustiveness_sealedClass.kt
|
||||
|
||||
}
|
||||
public final fun test_1(e: R|Base|): R|kotlin/Unit| {
|
||||
lval a: R|kotlin/Unit| = when (R|<local>/e|) {
|
||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
($subj$ is R|Base.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -35,7 +35,7 @@ FILE: exhaustiveness_sealedClass.kt
|
||||
}
|
||||
}
|
||||
|
||||
lval b: R|kotlin/Unit| = when (R|<local>/e|) {
|
||||
lval b: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
($subj$ is R|Base.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -70,7 +70,7 @@ FILE: exhaustiveness_sealedClass.kt
|
||||
|
||||
}
|
||||
public final fun test_2(e: R|Base?|): R|kotlin/Unit| {
|
||||
lval a: R|kotlin/Unit| = when (R|<local>/e|) {
|
||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
($subj$ is R|Base.A|) -> {
|
||||
Int(1)
|
||||
}
|
||||
|
||||
+6
-6
@@ -77,7 +77,7 @@ FILE: exhaustiveness_sealedSubClass.kt
|
||||
.R|kotlin/Int.plus|(Int(0))
|
||||
}
|
||||
public final fun test_2(e: R|A|): R|kotlin/Unit| {
|
||||
lval a: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
|
||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
($subj$ is R|D|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -85,8 +85,8 @@ FILE: exhaustiveness_sealedSubClass.kt
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
.<Unresolved name: plus>#(Int(0))
|
||||
lval b: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
|
||||
.R|kotlin/Int.plus|(Int(0))
|
||||
lval b: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
($subj$ is R|B|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -97,8 +97,8 @@ FILE: exhaustiveness_sealedSubClass.kt
|
||||
Int(3)
|
||||
}
|
||||
}
|
||||
.<Unresolved name: plus>#(Int(0))
|
||||
lval c: <ERROR TYPE REF: Unresolved name: plus> = when (R|<local>/e|) {
|
||||
.R|kotlin/Int.plus|(Int(0))
|
||||
lval c: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
($subj$ is R|B|) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -106,7 +106,7 @@ FILE: exhaustiveness_sealedSubClass.kt
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
.<Unresolved name: plus>#(Int(0))
|
||||
.R|kotlin/Int.plus|(Int(0))
|
||||
lval d: R|kotlin/Int| = when (R|<local>/e|) {
|
||||
($subj$ is R|C|) -> {
|
||||
Int(1)
|
||||
|
||||
+3
-3
@@ -35,18 +35,18 @@ fun test_2(e: A) {
|
||||
val a = <!NO_ELSE_IN_WHEN!>when<!> (e) {
|
||||
is D -> 1
|
||||
is E -> 2
|
||||
}.<!UNRESOLVED_REFERENCE!>plus<!>(0)
|
||||
}.plus(0)
|
||||
|
||||
val b = <!NO_ELSE_IN_WHEN!>when<!> (e) {
|
||||
is B -> 1
|
||||
is D -> 2
|
||||
is E -> 3
|
||||
}.<!UNRESOLVED_REFERENCE!>plus<!>(0)
|
||||
}.plus(0)
|
||||
|
||||
val c = <!NO_ELSE_IN_WHEN!>when<!> (e) {
|
||||
is B -> 1
|
||||
is D -> 2
|
||||
}.<!UNRESOLVED_REFERENCE!>plus<!>(0)
|
||||
}.plus(0)
|
||||
|
||||
val d = when (e) {
|
||||
is C -> 1
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
FILE: exhaustiveness_smartcastedBoolean.kt
|
||||
public final fun test_1(b: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
R|kotlin/require|((R|<local>/b| is R|kotlin/Boolean|))
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/b|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/b|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
@@ -28,7 +28,7 @@ FILE: exhaustiveness_smartcastedBoolean.kt
|
||||
}
|
||||
public final fun test_2(b: R|kotlin/Any?|): R|kotlin/Unit| {
|
||||
R|kotlin/require|((R|<local>/b| is R|kotlin/Boolean?|))
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/b|) {
|
||||
lval x: R|kotlin/Int| = when (R|<local>/b|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user