Avoid subtype checking between type variable of self type and captured star projection only for invariant positions
Subtyping with non-invariant positions may produce useful constraints ^KT-46001 Fixed
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface WithChildren<out T>
|
||||
|
||||
fun <T : WithChildren<*>> WithChildren<WithChildren<*>>.test() {
|
||||
withDescendants()
|
||||
}
|
||||
|
||||
fun <T : WithChildren<T>> T.withDescendants() {}
|
||||
|
||||
@JvmName("foo")
|
||||
fun WithChildren<*>.withDescendants() {}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T : WithChildren<*>> WithChildren<WithChildren<*>>.test(): kotlin.Unit
|
||||
public fun </*0*/ T : WithChildren<T>> T.withDescendants(): kotlin.Unit
|
||||
@kotlin.jvm.JvmName(name = "foo") public fun WithChildren<*>.withDescendants(): kotlin.Unit
|
||||
|
||||
public interface WithChildren</*0*/ out 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
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS
|
||||
|
||||
fun <E : Enum<E>> createMap(enumClass: Class<E>) {}
|
||||
|
||||
fun reproduce() {
|
||||
val enumClass: Class<Enum<*>> = "any" as Class<Enum<*>>
|
||||
<!INAPPLICABLE_CANDIDATE!>createMap<!>(enumClass)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS
|
||||
|
||||
fun <E : Enum<E>> createMap(enumClass: Class<E>) {}
|
||||
|
||||
fun reproduce() {
|
||||
val enumClass: Class<Enum<*>> = "any" as Class<Enum<*>>
|
||||
createMap(<!TYPE_MISMATCH, TYPE_MISMATCH!>enumClass<!>)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ E : kotlin.Enum<E>> createMap(/*0*/ enumClass: java.lang.Class<E>): kotlin.Unit
|
||||
public fun reproduce(): kotlin.Unit
|
||||
Reference in New Issue
Block a user