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:
committed by
Ilya Kirillov
parent
db82797f58
commit
efa3bf9c69
+6
-4
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
@@ -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) { }
|
||||
}
|
||||
|
||||
|
||||
@@ -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!!) { }
|
||||
}
|
||||
|
||||
|
||||
+9
@@ -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) { }
|
||||
}
|
||||
+9
@@ -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
|
||||
}
|
||||
@@ -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!!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user