FIR IDE: Consolidate tests for AddExclExclFix in one directory.

I found these tests only _after_ the previous changes, so I needed to
merge and/or remove redundant tests.
This commit is contained in:
Mark Punzalan
2021-04-28 08:01:14 +00:00
committed by Ilya Kirillov
parent db82797f58
commit efa3bf9c69
23 changed files with 74 additions and 160 deletions
+6 -4
View File
@@ -1,7 +1,9 @@
// "Add non-null asserted (!!) call" "true"
infix fun Int.bar(i: Int) = this
class SafeType {
infix fun op(arg: Int) {}
}
fun foo(i: Int?) {
i <caret>bar 1
}
fun safeB(p: SafeType?) {
val v = p <caret>op 42
}
+6 -4
View File
@@ -1,7 +1,9 @@
// "Add non-null asserted (!!) call" "true"
infix fun Int.bar(i: Int) = this
class SafeType {
infix fun op(arg: Int) {}
}
fun foo(i: Int?) {
i!! bar 1
}
fun safeB(p: SafeType?) {
val v = p!! op 42
}
+4 -4
View File
@@ -1,6 +1,6 @@
// "Add non-null asserted (!!) call" "true"
// WITH_RUNTIME
fun foo(a: List<String>?) {
for (s in <caret>a) {}
fun foo() {
val test : Collection<Int>? = null!!
for (i in <caret>test) { }
}
+4 -4
View File
@@ -1,6 +1,6 @@
// "Add non-null asserted (!!) call" "true"
// WITH_RUNTIME
fun foo(a: List<String>?) {
for (s in a!!) {}
fun foo() {
val test : Collection<Int>? = null!!
for (i in <caret>test!!) { }
}
@@ -0,0 +1,9 @@
// "Add non-null asserted (!!) call" "true"
class Some {
operator fun iterator(): Iterator<Int> = null!!
}
fun foo() {
val test: Some? = Some()
for (i in <caret>test) { }
}
@@ -0,0 +1,9 @@
// "Add non-null asserted (!!) call" "true"
class Some {
operator fun iterator(): Iterator<Int> = null!!
}
fun foo() {
val test: Some? = Some()
for (i in test!!) { }
}
@@ -0,0 +1,5 @@
// "Add non-null asserted (!!) call" "true"
fun <T: Collection<Int>?> foo(c: T) {
for (i in <caret>c) { }
}
@@ -0,0 +1,5 @@
// "Add non-null asserted (!!) call" "true"
fun <T: Collection<Int>?> foo(c: T) {
for (i in c!!) { }
}
@@ -0,0 +1,13 @@
// "Add non-null asserted (!!) call" "false"
// ACTION: Replace with a 'forEach' function call
// ACTION: Surround with null check
// ERROR: Not nullable value required to call an 'iterator()' method on for-loop range
class Some {
fun iterator(): Iterator<Int> = null!!
}
fun foo() {
val test: Some? = Some()
for (i in <caret>test) { }
}
@@ -0,0 +1,9 @@
// "Add non-null asserted (!!) call" "true"
class SafeType {
operator fun plus(arg: Int) {}
}
fun safeB(p: SafeType?) {
val v = p <caret>+ 42
}
@@ -0,0 +1,9 @@
// "Add non-null asserted (!!) call" "true"
class SafeType {
operator fun plus(arg: Int) {}
}
fun safeB(p: SafeType?) {
val v = p!! + 42
}
@@ -1,5 +0,0 @@
// "Add non-null asserted (!!) call" "true"
fun foo(i: Int?) {
i <caret>+ 1
}
@@ -1,5 +0,0 @@
// "Add non-null asserted (!!) call" "true"
fun foo(i: Int?) {
i!! + 1
}
+7 -3
View File
@@ -1,5 +1,9 @@
// "Add non-null asserted (!!) call" "true"
fun foo(i: Int?) {
<caret>-i
}
class SafeType {
operator fun unaryMinus() {}
}
fun safeB(p: SafeType?) {
val v = <caret>-p
}
@@ -1,5 +1,9 @@
// "Add non-null asserted (!!) call" "true"
fun foo(i: Int?) {
-i!!
}
class SafeType {
operator fun unaryMinus() {}
}
fun safeB(p: SafeType?) {
val v = -p!!
}