"Replace 'if' with elvis operator": don't suggest on super type check
#KT-27016 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
ffa3d7c57a
commit
fd6f34f8ca
@@ -0,0 +1,13 @@
|
||||
open class A
|
||||
|
||||
open class B : A() {
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val b = B()
|
||||
if (<caret>b !is B) {
|
||||
return
|
||||
}
|
||||
b.b()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
open class A
|
||||
|
||||
open class B : A() {
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val b = B() as? B ?: return
|
||||
b.b()
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
open class A
|
||||
|
||||
open class B : A() {
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
open class C : B() {
|
||||
fun c() {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val b = B()
|
||||
if (<caret>b !is C) {
|
||||
return
|
||||
}
|
||||
b.b()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
open class A
|
||||
|
||||
open class B : A() {
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
open class C : B() {
|
||||
fun c() {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val b = B() as? C ?: return
|
||||
b.b()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// IS_APPLICABLE: false
|
||||
open class A
|
||||
|
||||
open class B : A() {
|
||||
fun b() {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val b = B()
|
||||
if (<caret>b !is A) {
|
||||
return
|
||||
}
|
||||
b.b()
|
||||
}
|
||||
Reference in New Issue
Block a user