[NI] Don't consider Any!-constraint from upper bounds as more specific

#KT-31624 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-05-27 13:18:59 +03:00
parent 8bef345f0f
commit c30e045b1b
6 changed files with 90 additions and 6 deletions
@@ -0,0 +1,35 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
// FILE: Tasks.java
public class Tasks {
public static <T> Inv<T> call(JSam<T> f) {
return null;
}
}
// FILE: JSam.java
public interface JSam<V> {
V call();
}
// FILE: test.kt
fun <K> withLock(g: () -> K): K = g()
class Out<out P>
class Inv<S>
fun <R> Inv<R>.asOut(): Out<R> = TODO()
fun test() {
val o: Out<Int> = Tasks.call {
withLock { TODO() }
}.asOut()
<!DEBUG_INFO_EXPRESSION_TYPE("(Inv<(kotlin.Nothing..kotlin.Nothing?)>..Inv<(kotlin.Nothing..kotlin.Nothing?)>?)")!>Tasks.call {
withLock { TODO() }
}<!>
}
@@ -0,0 +1,36 @@
package
public fun test(): kotlin.Unit
public fun </*0*/ K> withLock(/*0*/ g: () -> K): K
public fun </*0*/ R> Inv<R>.asOut(): Out<R>
public final class Inv</*0*/ S> {
public constructor Inv</*0*/ S>()
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 JSam</*0*/ V : kotlin.Any!> {
public abstract fun call(): 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
}
public final class Out</*0*/ out P> {
public constructor Out</*0*/ out P>()
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 open class Tasks {
public constructor Tasks()
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
// Static members
public open fun </*0*/ T : kotlin.Any!> call(/*0*/ f: JSam<T!>!): Inv<T!>!
}