NI: Discard definitely not-null types inside invariant positions during inference process
^KT-36816 Fixed
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// Issues: KT-36816
|
||||
|
||||
interface Parent<T>
|
||||
|
||||
class Foo<K>(x: K?): Parent<K> {}
|
||||
class Bar<T>(x: T): Parent<T> {}
|
||||
|
||||
fun <R> select(vararg x: R) = x[0]
|
||||
|
||||
fun <S> main(x: S) {
|
||||
select(Foo(x), Bar(x))
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline fun <R> test(transform: () -> R) {}
|
||||
|
||||
class Inv<T>(x: T?) {}
|
||||
|
||||
fun <K> foo(x: K) {
|
||||
test { Inv(x) }
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// Issues: KT-36816
|
||||
|
||||
interface Parent<T>
|
||||
|
||||
class Foo<K>(x: K?): Parent<K> {}
|
||||
class Bar<T>(x: T): Parent<T> {}
|
||||
|
||||
fun <R> select(vararg x: R) = x[0]
|
||||
|
||||
fun <S> main(x: S) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Parent<S>")!>select(Foo(x), Bar(x))<!>
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline fun <R> test(transform: () -> R) {}
|
||||
|
||||
class Inv<T>(x: T?) {}
|
||||
|
||||
fun <K> foo(x: K) {
|
||||
test { <!DEBUG_INFO_EXPRESSION_TYPE("Inv<K>")!>Inv(x)<!> }
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K> foo(/*0*/ x: K): kotlin.Unit
|
||||
public fun </*0*/ S> main(/*0*/ x: S): kotlin.Unit
|
||||
public fun </*0*/ R> select(/*0*/ vararg x: R /*kotlin.Array<out R>*/): R
|
||||
public inline fun </*0*/ R> test(/*0*/ transform: () -> R): kotlin.Unit
|
||||
|
||||
public final class Bar</*0*/ T> : Parent<T> {
|
||||
public constructor Bar</*0*/ T>(/*0*/ x: 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
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ K> : Parent<K> {
|
||||
public constructor Foo</*0*/ K>(/*0*/ x: K?)
|
||||
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 Inv</*0*/ T> {
|
||||
public constructor Inv</*0*/ T>(/*0*/ x: 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
|
||||
}
|
||||
|
||||
public interface Parent</*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
|
||||
}
|
||||
Reference in New Issue
Block a user