Don't generate UNNECESSARY_SAFE_CALL on variables of generic type <T: Any?>
This commit is contained in:
@@ -4,7 +4,7 @@ package outer
|
||||
fun Int?.optint() : Unit {}
|
||||
val Int?.optval : Unit = Unit.VALUE
|
||||
|
||||
fun <T, E> T.foo(<!UNUSED_PARAMETER!>x<!> : E, y : A) : T {
|
||||
fun <T: Any, E> T.foo(<!UNUSED_PARAMETER!>x<!> : E, y : A) : T {
|
||||
y.plus(1)
|
||||
y plus 1
|
||||
y + 1.0
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
fun <T> test(t: T): String {
|
||||
if (t != null) {
|
||||
return t<!UNNECESSARY_SAFE_CALL!>?.<!>toString()
|
||||
}
|
||||
return t?.toString()
|
||||
}
|
||||
|
||||
fun <T> T.testThis(): String {
|
||||
if (this != null) {
|
||||
return this<!UNNECESSARY_SAFE_CALL!>?.<!>toString()
|
||||
}
|
||||
return this?.toString()
|
||||
}
|
||||
Reference in New Issue
Block a user