[FIR] Check is for impossibility
^KT-58203 Fixed ^KT-62646
This commit is contained in:
committed by
Space Team
parent
92d8da621e
commit
88ff93df7f
Vendored
+1
-1
@@ -11,7 +11,7 @@ fun test_1(e: Enum) {
|
||||
val b = <!NO_ELSE_IN_WHEN!>when<!> (e) {
|
||||
Enum.A -> 1
|
||||
Enum.B -> 2
|
||||
is String -> 3
|
||||
<!USELESS_IS_CHECK!>is String<!> -> 3
|
||||
}
|
||||
|
||||
val c = when (e) {
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@ fun test_1(e: JavaEnum) {
|
||||
val b = <!NO_ELSE_IN_WHEN!>when<!> (e) {
|
||||
JavaEnum.A -> 1
|
||||
JavaEnum.B -> 2
|
||||
is String -> 3
|
||||
<!USELESS_IS_CHECK!>is String<!> -> 3
|
||||
}.plus(0)
|
||||
|
||||
val c = when (e) {
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@ fun test_1(e: Base) {
|
||||
val b = <!NO_ELSE_IN_WHEN!>when<!> (e) {
|
||||
is Base.A -> 1
|
||||
is Base.A.B -> 2
|
||||
is String -> 3
|
||||
<!USELESS_IS_CHECK!>is String<!> -> 3
|
||||
}
|
||||
|
||||
val c = when (e) {
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ fun test_2(x: Any) {
|
||||
fun test_3(x: Any) {
|
||||
when {
|
||||
x !is String -> {}
|
||||
x !is Int -> {}
|
||||
<!USELESS_IS_CHECK!>x !is Int<!> -> {}
|
||||
else -> {
|
||||
x.length
|
||||
x.inc()
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ fun test_1(x: Any?) {
|
||||
when {
|
||||
x !is A -> {}
|
||||
x !is B -> x.foo()
|
||||
x is Int -> {
|
||||
<!USELESS_IS_CHECK!>x is Int<!> -> {
|
||||
x.foo()
|
||||
x.bar()
|
||||
x.inc()
|
||||
@@ -37,7 +37,7 @@ fun test_2(x: Any?) {
|
||||
when(x) {
|
||||
!is A -> {}
|
||||
!is B -> x.foo()
|
||||
is Int -> {
|
||||
<!USELESS_IS_CHECK!>is Int<!> -> {
|
||||
x.foo()
|
||||
x.bar()
|
||||
x.inc()
|
||||
@@ -67,7 +67,7 @@ fun test_3(x: Any?) {
|
||||
x.foo()
|
||||
y.foo()
|
||||
}
|
||||
is Int -> {
|
||||
<!USELESS_IS_CHECK!>is Int<!> -> {
|
||||
x.foo()
|
||||
x.bar()
|
||||
x.inc()
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ fun Any?.test_4() {
|
||||
<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
this.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
} else if (this !is B) {
|
||||
} else if (<!USELESS_IS_CHECK!>this !is B<!>) {
|
||||
this.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
this.foo()
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ fun test1(x: String?): Int? {
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun test2(x: String?): Int? {
|
||||
<!WRONG_IMPLIES_CONDITION!>contract {
|
||||
returnsNotNull() implies (x is Boolean)
|
||||
returnsNotNull() implies (<!USELESS_IS_CHECK!>x is Boolean<!>)
|
||||
}<!>
|
||||
|
||||
return x?.length
|
||||
|
||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ fun <T> deserializeAndLoadState(
|
||||
) {}
|
||||
|
||||
fun use(beforeRunTask: BeforeRunTask<*>) {
|
||||
if (beforeRunTask is PersistentStateComponent<*>) {
|
||||
if (<!USELESS_IS_CHECK!>beforeRunTask is PersistentStateComponent<*><!>) {
|
||||
deserializeAndLoadState(beforeRunTask)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,5 +14,5 @@ fun foo(u: U) {
|
||||
val w = +i
|
||||
|
||||
val g = "" !in u
|
||||
val f = "" !is Boolean
|
||||
val f = <!USELESS_IS_CHECK!>"" !is Boolean<!>
|
||||
}
|
||||
Reference in New Issue
Block a user