Support for !! (analog of sure()/npe())

This commit is contained in:
Andrey Breslav
2012-03-22 12:36:40 +01:00
parent 4a3d0133f6
commit 7341a82b0b
10 changed files with 449 additions and 375 deletions
@@ -0,0 +1,35 @@
fun main(args : Array<String>) {
val a : Int? = null
val b : Int? = null
a!! : Int
a!! + 2
a!!.plus(2)
a!!.plus(b!!)
2.plus(b!!)
2 + b!!
val c = 1
c<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
val d : Any? = null
if (d != null) {
d<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
}
if (d is String) {
d<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
}
if (d is String?) {
if (d != null) {
d<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
}
if (d is String) {
d<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
}
}
val <!UNUSED_VARIABLE!>f<!> : String = <!TYPE_MISMATCH!>a!!<!>
<!TYPE_MISMATCH!>a!!<!> : String
}