56557fb8ff
Result of the `checkNotNull` calls should always be a non-nullable values. The simplest idea how to acheive it is adding not-nullable Any bound to the type parameter declaration. Existing comment stating about impossibility of such bound seems to be not 100% correct because it doesn't take into account presence of definitely-non-nullable X & Any types that allow described case with nullable generic. ^KT-55804 Fixed
17 lines
595 B
Plaintext
Vendored
17 lines
595 B
Plaintext
Vendored
FILE: exclExclInference.fir.kt
|
|
public final fun foo(): R|kotlin/Unit| {
|
|
lval x: R|kotlin/String?|
|
|
R|<local>/x| = R|/materialize|<R|kotlin/String?|>()!!
|
|
R|<local>/x|.R|kotlin/String.length|
|
|
}
|
|
public final fun <E> materialize(): R|E| {
|
|
^materialize R|kotlin/TODO|()
|
|
}
|
|
public final fun <F> test(f: R|F|): R|F & Any| {
|
|
^test R|<local>/f|!!
|
|
}
|
|
public final fun main(): R|kotlin/Unit| {
|
|
R|/test|<R|kotlin/String|>(String()).R|kotlin/String.length|
|
|
R|/test|<R|kotlin/String?|>(Null(null)).R|kotlin/String.length|
|
|
}
|