Suggest to add !! as a quick-fix for type mistmach
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// "Add non-null asserted (!!) call" "true"
|
||||
fun test() {
|
||||
val s: String? = null
|
||||
other(<caret>s)
|
||||
}
|
||||
|
||||
fun other(s: String) {}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add non-null asserted (!!) call" "true"
|
||||
fun test() {
|
||||
val s: String? = null
|
||||
other(<caret>s!!)
|
||||
}
|
||||
|
||||
fun other(s: String) {}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Add non-null asserted (!!) call" "false"
|
||||
// ACTION: Change parameter 's' type of function 'other' to 'String?'
|
||||
// ERROR: <html>ype mismatch.<table><tr><td>Required:</td><td>kotlin.Int</td></tr><tr><td>Found:</td><td>kotlin.String?</td></tr></table></html>
|
||||
fun test() {
|
||||
val s: String? = ""
|
||||
other(<caret>s)
|
||||
}
|
||||
|
||||
fun other(s: Int) {}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Add non-null asserted (!!) call" "true"
|
||||
interface Some
|
||||
|
||||
fun <T: Some?> test(t: T) {
|
||||
other(<caret>t)
|
||||
}
|
||||
|
||||
fun other(s: Any) {}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Add non-null asserted (!!) call" "true"
|
||||
interface Some
|
||||
|
||||
fun <T: Some?> test(t: T) {
|
||||
other(t!!)
|
||||
}
|
||||
|
||||
fun other(s: Any) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Add non-null asserted (!!) call" "true"
|
||||
|
||||
interface A<out T>
|
||||
class B<out T>: A<T>
|
||||
|
||||
open class C
|
||||
open class D: C()
|
||||
|
||||
fun test() {
|
||||
val s: B<D>? = B()
|
||||
other(<caret>s)
|
||||
}
|
||||
|
||||
fun other(s: A<C>) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Add non-null asserted (!!) call" "true"
|
||||
|
||||
interface A<out T>
|
||||
class B<out T>: A<T>
|
||||
|
||||
open class C
|
||||
open class D: C()
|
||||
|
||||
fun test() {
|
||||
val s: B<D>? = B()
|
||||
other(<caret>s!!)
|
||||
}
|
||||
|
||||
fun other(s: A<C>) {}
|
||||
Reference in New Issue
Block a user