KT-2164 !! does not propagate nullability information

This commit is contained in:
Alexander Udalov
2012-06-15 22:03:00 +04:00
parent d777313132
commit 845c3198bd
2 changed files with 43 additions and 0 deletions
@@ -0,0 +1,38 @@
//KT-2164 !! does not propagate nullability information
package kt2164
fun foo(x: Int): Int = x + 1
fun main(args : Array<String>) {
val x: Int? = null
foo(<!TYPE_MISMATCH!>x<!>)
if (x != null) {
foo(x)
foo(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
foo(x)
}
foo(<!TYPE_MISMATCH!>x<!>)
if (x != null) {
foo(x)
foo(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
foo(x)
} else {
foo(<!TYPE_MISMATCH!>x<!>)
foo(x!!)
foo(x)
}
foo(x)
foo(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
foo(x)
val y: Int? = null
y!!
y<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
foo(y)
foo(y<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
}