FIR quickfix: Enable addExclExclCall tests for FIR, move typeMismatch

tests for addExclExclCall to addExclExclCall directory.
This commit is contained in:
Mark Punzalan
2021-04-23 18:05:54 +00:00
committed by Ilya Kirillov
parent 85cbea70bf
commit 71a8d9c0bb
20 changed files with 363 additions and 176 deletions
@@ -0,0 +1,5 @@
// "Add non-null asserted (!!) call" "true"
fun test() {
val s: String? = null
val z: String = <caret>s
}
@@ -0,0 +1,5 @@
// "Add non-null asserted (!!) call" "true"
fun test() {
val s: String? = null
val z: String = s!!
}
@@ -0,0 +1,12 @@
// "Add non-null asserted (!!) call" "true"
class C {
val s: String? = null
}
// Test for KTIJ-10052
fun C.test() {
other(<caret>s)
}
fun other(s: String) {}
@@ -0,0 +1,12 @@
// "Add non-null asserted (!!) call" "true"
class C {
val s: String? = null
}
// Test for KTIJ-10052
fun C.test() {
other(s!!)
}
fun other(s: String) {}
@@ -0,0 +1,9 @@
// "Add non-null asserted (!!) call" "true"
class C {
val s: String? = null
}
// Test for KTIJ-10052
fun C.test() {
val z: String = <caret>s
}
@@ -0,0 +1,9 @@
// "Add non-null asserted (!!) call" "true"
class C {
val s: String? = null
}
// Test for KTIJ-10052
fun C.test() {
val z: String = s!!
}
@@ -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,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) {}
@@ -0,0 +1,10 @@
// "class org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix" "false"
// ACTION: Change parameter 's' type of function 'other' to 'String?'
// ACTION: Create function 'other'
// ERROR: Type mismatch: inferred type is String? but Int was expected
fun test() {
val s: String? = ""
other(<caret>s)
}
fun other(s: Int) {}
@@ -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) {}
@@ -0,0 +1,8 @@
// "Add non-null asserted (!!) call" "true"
interface Some
fun <T: Some?> test(t: T) {
other(t!!)
}
fun other(s: Any) {}
@@ -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>) {}
@@ -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>) {}
@@ -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()
}
}
}