Add quick fixes for SMARTCAST_IMPOSSIBLE in 'if' #KT-27184 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
a0162adbf9
commit
cf3215b96e
+18
@@ -0,0 +1,18 @@
|
||||
// "Replace 'if' expression with elvis expression" "false"
|
||||
// ACTION: Add non-null asserted (!!) call
|
||||
// ACTION: Introduce local variable
|
||||
// DISABLE-ERRORS
|
||||
class Test {
|
||||
var x: String? = ""
|
||||
|
||||
fun test() {
|
||||
val i = if (x != null) {
|
||||
bar()
|
||||
<caret>x.length
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
fun bar() {}
|
||||
}
|
||||
Reference in New Issue
Block a user