Files
kotlin-fork/idea/testData/quickfix/expressions/fixNullableWithExclExclAbsentWithBadIterator.kt
T
Mark Punzalan db82797f58 FIR IDE: Enable AddExclExclCallFix for UNSAFE_CALL,
UNSAFE_OPERATOR_CALL, UNSAFE_INFIX_CALL, ITERATOR_ON_NULLABLE,
ARGUMENT_TYPE_MISMATCH, RETURN_TYPE_MISMATCH.

TODO: Don't offer fix when target is known to be null (from data flow
analysis).
2021-05-20 20:32:56 +02:00

14 lines
352 B
Kotlin
Vendored

// "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) { }
}