Files
kotlin-fork/compiler/testData/diagnostics/tests/controlStructures/forWithNullableIterator.kt
T
Mikhail Glukhikh a736d62edd FirForLoopChecker: report also OPERATOR_MODIFIER if appropriate + minor
This commits checks iterator/hasNext/next functions whether they are
declared as operator or not. Also, it changes logic of hasNext/next
error reporting, now we're able to report errors about both these
functions.
2021-04-19 15:11:10 +03:00

13 lines
243 B
Kotlin
Vendored

// FIR_IDENTICAL
class Coll {
operator fun iterator(): It? = null
}
class It {
operator fun next() = 1
operator fun hasNext() = false
}
fun test() {
for (x in <!HAS_NEXT_FUNCTION_NONE_APPLICABLE, NEXT_NONE_APPLICABLE!>Coll()<!>) {}
}