For-loop range expression (collection) can not be null

This commit is contained in:
Andrey Breslav
2012-08-24 15:36:55 +04:00
parent b315bee7b2
commit 66faa0c03a
24 changed files with 39 additions and 60 deletions
@@ -1,20 +0,0 @@
package test.language
import junit.framework.TestCase
import java.util.Collection
import kotlin.test.*
class NullableCollectionsTest : TestCase() {
fun testIterateOverNullCollectionsThrowsNPE() {
val c: Collection<String>? = null
// TODO currently this will throw a NPE
// should it either be a compile error or handle nulls gracefully?
failsWith<NullPointerException> {
for (e in c) {
println("Hey got $e")
}
}
}
}
@@ -128,7 +128,7 @@ import js.noImpl
}
}
for (pk in properties.values()) {
for (pk in properties.values()!!) {
// some properties might not have a getter defined
// so lets ignore those