Quick fix "add !!" for SMARTCAST_IMPOSSIBLE in certain situations

This commit is contained in:
Mikhail Glukhikh
2016-06-01 17:28:17 +03:00
parent 7eafae1936
commit 33b6780ce2
5 changed files with 62 additions and 0 deletions
@@ -0,0 +1,17 @@
// "Add non-null asserted (!!) call" "true"
// ACTION: Cast expression 'a' to 'Foo'
interface Foo {
fun bar()
}
open class MyClass {
open val a: Foo? = null
fun foo() {
if (a != null) {
<caret>a.bar()
}
}
}
@@ -0,0 +1,17 @@
// "Add non-null asserted (!!) call" "true"
// ACTION: Cast expression 'a' to 'Foo'
interface Foo {
fun bar()
}
open class MyClass {
open val a: Foo? = null
fun foo() {
if (a != null) {
a!!.bar()
}
}
}