KT-6077 Compiler does not issue error on unsafe access to ArrayList with nullable values

#KT-6077 Fixed
This commit is contained in:
Andrey Breslav
2014-10-21 13:49:14 +04:00
parent 7b89771953
commit a14eefcea3
13 changed files with 184 additions and 6 deletions
@@ -4,5 +4,6 @@ trait Foo
fun test() {
var nullable: Foo? = null
val foo: Collection<Foo> = java.util.Collections.singleton(nullable)
val foo: Collection<Foo> = <!TYPE_MISMATCH!>java.util.Collections.singleton(nullable)<!>
val foo1: Collection<Foo> = java.util.Collections.singleton(nullable!!)
}
@@ -0,0 +1,9 @@
import java.util.ArrayList
fun foo() {
val list = ArrayList<String?>()
for (s in list) {
s<!UNSAFE_CALL!>.<!>length
}
}
@@ -0,0 +1,3 @@
package
internal fun foo(): kotlin.Unit