[FIR] Don't miss smartcast info on equalities with when subjects
Since they are not `FirSmartCastExpression`s, they are treated as proper original types, thus leading to reporting errors instead of warnings. ^KT-60095 Fixed
This commit is contained in:
committed by
Space Team
parent
4f96171716
commit
f5d859f209
+1
-1
@@ -9,7 +9,7 @@ fun foo(a: Any) {
|
||||
}
|
||||
|
||||
when (a) {
|
||||
<!CONFUSING_BRANCH_CONDITION_ERROR, EQUALITY_NOT_APPLICABLE_WARNING, INCOMPATIBLE_TYPES!>a == 1<!> -> print("1")
|
||||
<!CONFUSING_BRANCH_CONDITION_ERROR, EQUALITY_NOT_APPLICABLE_WARNING, INCOMPATIBLE_TYPES_WARNING!>a == 1<!> -> print("1")
|
||||
}
|
||||
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>(a <!USELESS_CAST!>as A<!>) == (<!EQUALITY_NOT_APPLICABLE_WARNING!>a == 1<!>)<!>) {
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ fun incompatibleTypes(a: Int) = when(a) {
|
||||
fun incompatibleTypesSmartCast(a: Any?) {
|
||||
if (a is Int) {
|
||||
when(a) {
|
||||
<!INCOMPATIBLE_TYPES!>C(10)<!> -> 1
|
||||
<!INCOMPATIBLE_TYPES_WARNING!>C(10)<!> -> 1
|
||||
else -> 2
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user