FIR: make deeper recursive type alias expansion check (see KT-37000)

This commit is contained in:
Mikhail Glukhikh
2022-03-10 13:49:54 +03:00
committed by Space
parent c8237cb5e2
commit 6ecc97575d
7 changed files with 39 additions and 3 deletions
@@ -590,11 +590,18 @@ class SupertypeComputationSession {
checkIsInLoop(supertypeFir)
if (isTypeAlias) {
for (typeArgument in supertypeRef.type.typeArguments) {
if (typeArgument is ConeClassLikeType) {
checkIsInLoop(typeArgument.lookupTag.toSymbol(session)?.fir)
fun checkTypeArgumentsRecursively(type: ConeKotlinType, visitedTypes: MutableSet<ConeKotlinType>) {
if (type in visitedTypes) return
visitedTypes += type
for (typeArgument in type.typeArguments) {
if (typeArgument is ConeClassLikeType) {
checkIsInLoop(typeArgument.lookupTag.toSymbol(session)?.fir)
checkTypeArgumentsRecursively(typeArgument, visitedTypes)
}
}
}
checkTypeArgumentsRecursively(supertypeRef.type, mutableSetOf())
}
resultSupertypeRefs.add(