[NI] Fix common supertype of types with error supertypes
Enable check for error supertypes during CST calculation in classic type system context. Cyclic upper bound + known type parameters of superclasses may create non-error types with error supertypes. Such types don't have common constructors with other normal types and cause assertion errors during intersection. ^KT-36951 Fixed
This commit is contained in:
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Foo<F> {
|
||||
fun getSum(): F = TODO()
|
||||
}
|
||||
|
||||
fun <S> select(vararg args: S): S = TODO()
|
||||
|
||||
class Bar<B : B> : Foo<B> {
|
||||
val v = <!DEBUG_INFO_EXPRESSION_TYPE("B?")!>select(
|
||||
getSum(),
|
||||
42
|
||||
)<!>
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Foo<F> {
|
||||
fun getSum(): F = TODO()
|
||||
}
|
||||
|
||||
fun <S> select(vararg args: S): S = TODO()
|
||||
|
||||
class Bar<B : <!CYCLIC_GENERIC_UPPER_BOUND!>B<!>> : Foo<B> {
|
||||
val v = <!DEBUG_INFO_EXPRESSION_TYPE("[ERROR : from type constructor([ERROR : Cyclic upper bounds])]")!>select(
|
||||
<!DEBUG_INFO_LEAKING_THIS!>getSum<!>(),
|
||||
42
|
||||
)<!>
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
|
||||
|
||||
public final class Bar</*0*/ B : [ERROR : Cyclic upper bounds]> : Foo<B> {
|
||||
public constructor Bar</*0*/ B : [ERROR : Cyclic upper bounds]>()
|
||||
public final val v: [ERROR : from type constructor([ERROR : Cyclic upper bounds])]
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun getSum(): B
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Foo</*0*/ F> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun getSum(): F
|
||||
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