Surround with null check : apply for ITERATOR_ON_NULLABLE
This commit is contained in:
+1
@@ -1,5 +1,6 @@
|
||||
// "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 {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Surround with null check" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(list: List<String>?) {
|
||||
for (element in <caret>list) {}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Surround with null check" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(list: List<String>?) {
|
||||
if (list != null) {
|
||||
for (element in list) {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user