[NI] Don't avoid Nothing-like constraints if Nothing was in initial type
#KT-32081 Fixed #KT-32951 Fixed
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
|
||||
|
||||
interface LevelA
|
||||
interface LevelB : LevelA
|
||||
|
||||
class BiType<out X, out Y> {
|
||||
fun <X> pullXb(x: X): BiType<X, LevelB> = TODO()
|
||||
fun <Y> pullYb(y: Y): BiType<LevelB, Y> = TODO()
|
||||
fun <X> pullXn(x: X): BiType<X, Nothing> = TODO()
|
||||
fun <Y> pullYn(y: Y): BiType<Nothing, Y> = TODO()
|
||||
}
|
||||
|
||||
fun <X> adjustIt(fn: () -> X): X = TODO()
|
||||
fun <X> adjustIt(f1: () -> X, f2: () -> X): X = TODO()
|
||||
|
||||
fun <X> callAdjustIt(t: BiType<*, *>, x: X, level: LevelA) {
|
||||
val x1 = adjustIt({ t.pullXb(x) })
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("BiType<X, LevelB>")!>x1<!>
|
||||
|
||||
val x2 = adjustIt({ t.pullXn(x) })
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("BiType<X, kotlin.Nothing>")!>x2<!>
|
||||
|
||||
val x3 = adjustIt({ t.pullXb(x) }, { t.pullYb(level) })
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("BiType<kotlin.Any?, LevelA>")!>x3<!>
|
||||
|
||||
val x4 = adjustIt({ t.pullXn(x) }, { t.pullYn(level) })
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("BiType<X, LevelA>")!>x4<!>
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ X> adjustIt(/*0*/ fn: () -> X): X
|
||||
public fun </*0*/ X> adjustIt(/*0*/ f1: () -> X, /*1*/ f2: () -> X): X
|
||||
public fun </*0*/ X> callAdjustIt(/*0*/ t: BiType<*, *>, /*1*/ x: X, /*2*/ level: LevelA): kotlin.Unit
|
||||
|
||||
public final class BiType</*0*/ out X, /*1*/ out Y> {
|
||||
public constructor BiType</*0*/ out X, /*1*/ out Y>()
|
||||
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 final fun </*0*/ X> pullXb(/*0*/ x: X): BiType<X, LevelB>
|
||||
public final fun </*0*/ X> pullXn(/*0*/ x: X): BiType<X, kotlin.Nothing>
|
||||
public final fun </*0*/ Y> pullYb(/*0*/ y: Y): BiType<LevelB, Y>
|
||||
public final fun </*0*/ Y> pullYn(/*0*/ y: Y): BiType<kotlin.Nothing, Y>
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface LevelA {
|
||||
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
|
||||
}
|
||||
|
||||
public interface LevelB : LevelA {
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun <T> select(x: T, y: T): T = x
|
||||
|
||||
fun foo(x: Int, stringNothing: Out2<String, Nothing>): Out2<String, Int> =
|
||||
select(x.right(), stringNothing)
|
||||
|
||||
fun <R> R.right(): Out2<Nothing, R> = TODO()
|
||||
|
||||
class Out2<out K, out V>
|
||||
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ x: kotlin.Int, /*1*/ stringNothing: Out2<kotlin.String, kotlin.Nothing>): Out2<kotlin.String, kotlin.Int>
|
||||
public fun </*0*/ T> select(/*0*/ x: T, /*1*/ y: T): T
|
||||
public fun </*0*/ R> R.right(): Out2<kotlin.Nothing, R>
|
||||
|
||||
public final class Out2</*0*/ out K, /*1*/ out V> {
|
||||
public constructor Out2</*0*/ out K, /*1*/ out V>()
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user