[NI] Infer type variable to Nothing if all upper constraints are from upper bounds

#KT-32196 Fixed
This commit is contained in:
Dmitriy Novozhilov
2019-12-19 11:35:20 +03:00
parent 7fed7a840b
commit e466fd5196
7 changed files with 54 additions and 5 deletions
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Inv<T>
fun <R : Any> Inv<Int>.mapNotNull(transform: (Int) -> R?): Inv<R> = null!!
fun test(inv: Inv<Int>) {
inv.mapNotNull { null }
}
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Inv<T>
fun <R : Any> Inv<Int>.mapNotNull(transform: (Int) -> R?): Inv<R> = null!!
fun test(inv: Inv<Int>) {
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<kotlin.Nothing>")!>inv.mapNotNull { null }<!>
}
@@ -0,0 +1,11 @@
package
public fun test(/*0*/ inv: Inv<kotlin.Int>): kotlin.Unit
public fun </*0*/ R : kotlin.Any> Inv<kotlin.Int>.mapNotNull(/*0*/ transform: (kotlin.Int) -> R?): Inv<R>
public final class Inv</*0*/ T> {
public constructor Inv</*0*/ T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}