@@ -1966,7 +1966,8 @@ resolveTypeDeclsToNominal(Evaluator &evaluator,
1966
1966
ASTContext &ctx,
1967
1967
ArrayRef<TypeDecl *> typeDecls,
1968
1968
SmallVectorImpl<ModuleDecl *> &modulesFound,
1969
- bool &anyObject) {
1969
+ bool &anyObject,
1970
+ llvm::SmallPtrSetImpl<TypeAliasDecl *> &typealiases) {
1970
1971
TinyPtrVector<NominalTypeDecl *> nominalDecls;
1971
1972
1972
1973
for (auto typeDecl : typeDecls) {
@@ -1978,11 +1979,16 @@ resolveTypeDeclsToNominal(Evaluator &evaluator,
1978
1979
1979
1980
// Recursively resolve typealiases.
1980
1981
if (auto typealias = dyn_cast<TypeAliasDecl>(typeDecl)) {
1982
+ // FIXME: Ad hoc recursion breaking, so we don't look through the
1983
+ // same typealias multiple times.
1984
+ if (!typealiases.insert (typealias).second )
1985
+ continue ;
1986
+
1981
1987
auto underlyingTypeReferences
1982
1988
= evaluator (UnderlyingTypeDeclsReferencedRequest{typealias});
1983
1989
auto underlyingNominalReferences
1984
1990
= resolveTypeDeclsToNominal (evaluator, ctx, underlyingTypeReferences,
1985
- modulesFound, anyObject);
1991
+ modulesFound, anyObject, typealiases );
1986
1992
nominalDecls.insert (nominalDecls.end (),
1987
1993
underlyingNominalReferences.begin (),
1988
1994
underlyingNominalReferences.end ());
@@ -2024,6 +2030,17 @@ resolveTypeDeclsToNominal(Evaluator &evaluator,
2024
2030
return nominalDecls;
2025
2031
}
2026
2032
2033
+ static TinyPtrVector<NominalTypeDecl *>
2034
+ resolveTypeDeclsToNominal (Evaluator &evaluator,
2035
+ ASTContext &ctx,
2036
+ ArrayRef<TypeDecl *> typeDecls,
2037
+ SmallVectorImpl<ModuleDecl *> &modulesFound,
2038
+ bool &anyObject) {
2039
+ llvm::SmallPtrSet<TypeAliasDecl *, 4 > typealiases;
2040
+ return resolveTypeDeclsToNominal (evaluator, ctx, typeDecls, modulesFound,
2041
+ anyObject, typealiases);
2042
+ }
2043
+
2027
2044
// / Perform unqualified name lookup for types at the given location.
2028
2045
static DirectlyReferencedTypeDecls
2029
2046
directReferencesForUnqualifiedTypeLookup (ASTContext &ctx, DeclName name,
0 commit comments