KT-6077 Compiler does not issue error on unsafe access to ArrayList with nullable values
#KT-6077 Fixed
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user