psi2ir: Fix implicit casts generation

Implicit cast from T to S is not required if
  T <: S.makeNullable()
This commit is contained in:
Dmitry Petrov
2018-05-29 15:46:16 +03:00
parent dac9036969
commit cb301763f3
7 changed files with 320 additions and 9 deletions
@@ -0,0 +1,15 @@
fun test1(x: String?) =
if (x == null) 0 else x.length
fun <T : CharSequence?> test2(x: T) =
if (x == null) 0 else x.length
inline fun <reified T : CharSequence?> test3(x: Any) =
if (x !is T) 0 else x.length
inline fun <reified T : CharSequence> test4(x: Any?) =
if (x !is T) 0 else x.length
fun <T : S?, S> test5(x: T, fn: (S) -> Unit) {
if (x != null) fn(x)
}