Skip to content

Commit d195f00

Browse files
authored
[ClangImporter] Break infinite recursion when failing to import. (#9253)
Fixes a bug in cb9b9ea where a compatibility typealias for a type that's been import-as-member'd can't resolve the member, because we're already in the middle of importing members of the enclosing type. No tests at the moment because I want to get this in quickly, but also because the real issue is still there: this should import successfully. rdar://problem/31921746
1 parent 5bd63fe commit d195f00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4735,7 +4735,7 @@ Decl *SwiftDeclConverter::importCompatibilityTypeAlias(
47354735
Decl *importedDecl = nullptr;
47364736
if (getVersion() >= getActiveSwiftVersion())
47374737
importedDecl = Impl.importDecl(decl, ImportNameVersion::ForTypes);
4738-
if (!importedDecl)
4738+
if (!importedDecl && getVersion() != getActiveSwiftVersion())
47394739
importedDecl = Impl.importDecl(decl, getActiveSwiftVersion());
47404740
auto typeDecl = dyn_cast_or_null<TypeDecl>(importedDecl);
47414741
if (!typeDecl)

0 commit comments

Comments
 (0)