[FIR] Ignore visited super types during bypass in FirInconsistentTypeParameterHelpers
Get rid of potential exponential complexity
This commit is contained in:
+6
-2
@@ -58,6 +58,7 @@ private fun buildDeepSubstitutionMultimap(
|
||||
): Map<FirTypeParameterSymbol, ClassSymbolAndProjections> {
|
||||
val result = mutableMapOf<FirTypeParameterSymbol, ClassSymbolAndProjections>()
|
||||
val substitution = mutableMapOf<FirTypeParameterSymbol, ConeKotlinType>()
|
||||
val visitedSupertypes = mutableSetOf<ConeKotlinType>()
|
||||
val session = context.session
|
||||
val typeContext = session.typeContext
|
||||
|
||||
@@ -94,9 +95,12 @@ private fun buildDeepSubstitutionMultimap(
|
||||
}
|
||||
|
||||
for (superTypeRef in classSymbol.resolvedSuperTypeRefs) {
|
||||
val fullyExpandedType = superTypeRef.coneType.fullyExpandedType(session)
|
||||
if (!visitedSupertypes.add(fullyExpandedType))
|
||||
return
|
||||
|
||||
val superClassSymbol = fullyExpandedType.toRegularClassSymbol(session)
|
||||
withSuppressedDiagnostics(superTypeRef, context) {
|
||||
val fullyExpandedType = superTypeRef.coneType.fullyExpandedType(session)
|
||||
val superClassSymbol = fullyExpandedType.toRegularClassSymbol(session)
|
||||
if (!fullyExpandedType.isEnum && superClassSymbol != null) {
|
||||
fillInDeepSubstitutor(fullyExpandedType.typeArguments, superClassSymbol)
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
interface A
|
||||
interface B : A
|
||||
|
||||
interface ListA : List<A>
|
||||
interface ListB : List<B>
|
||||
|
||||
interface Z<<!INCONSISTENT_TYPE_PARAMETER_BOUNDS!>T<!>> where T : ListA, T : ListB
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
interface A
|
||||
interface B : A
|
||||
|
||||
|
||||
Reference in New Issue
Block a user