KT-2991 Don't generate UNNECESSARY_NOT_NULL_ASSERTION on variables of

generic type T:Any?

 #KT-2991 Fixed
This commit is contained in:
Andrey Breslav
2012-10-25 07:15:30 +04:00
parent edb8797fa6
commit 3e38870ecc
3 changed files with 24 additions and 10 deletions
@@ -0,0 +1,14 @@
fun <T> test(t: T): T {
if (t != null) {
return t<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
}
return t!!
}
fun <T> T.testThis(): String {
if (this != null) {
return this<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.toString()
}
return this!!.toString()
}