Cast to type quick-fix: handle case with qualified elements correctly
Same fix for 'add !!' fix So #KT-18368 Fixed
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
// "Add non-null asserted (!!) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A {
|
||||
fun foo(): List<Int?> = listOf()
|
||||
|
||||
fun bar(i : Int, s: String) = Unit
|
||||
|
||||
fun use() {
|
||||
val a = A()
|
||||
a.bar(a.foo().<caret>single(), "Asd")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Add non-null asserted (!!) call" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A {
|
||||
fun foo(): List<Int?> = listOf()
|
||||
|
||||
fun bar(i : Int, s: String) = Unit
|
||||
|
||||
fun use() {
|
||||
val a = A()
|
||||
a.bar(a.foo().single()!!, "Asd")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Cast expression 'a.foo().single()' to 'Int'" "true"
|
||||
// WITH_RUNTIME
|
||||
class A {
|
||||
fun foo(): List<Any> = listOf()
|
||||
|
||||
fun bar(i : Int, s: String) = Unit
|
||||
|
||||
fun use() {
|
||||
val a = A()
|
||||
a.bar(a.foo().single<caret>(), "Asd")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Cast expression 'a.foo().single()' to 'Int'" "true"
|
||||
// WITH_RUNTIME
|
||||
class A {
|
||||
fun foo(): List<Any> = listOf()
|
||||
|
||||
fun bar(i : Int, s: String) = Unit
|
||||
|
||||
fun use() {
|
||||
val a = A()
|
||||
a.bar(a.foo().single() as Int, "Asd")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user