Skip to content

Commit c7c0fed

Browse files
committed
[Clang importer] Narrow mirrored-import fixes to only consider 'async'.
The previous change was too broad and caused several regressions.
1 parent d249b5c commit c7c0fed

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7459,15 +7459,25 @@ void SwiftDeclConverter::importNonOverriddenMirroredMethods(DeclContext *dc,
74597459

74607460
// Import the method.
74617461
auto proto = entries[i].second;
7462-
Impl.forEachDistinctName(objcMethod,
7463-
[&](ImportedName name, ImportNameVersion version) {
7464-
if (auto imported =
7465-
Impl.importMirroredDecl(objcMethod, dc, version, proto)) {
7466-
if (imported->getDeclContext() == dc)
7467-
members.push_back(imported);
7462+
if (auto imported =
7463+
Impl.importMirroredDecl(objcMethod, dc, getVersion(), proto)) {
7464+
members.push_back(imported);
7465+
7466+
for (auto alternate : Impl.getAlternateDecls(imported)) {
7467+
if (imported->getDeclContext() == alternate->getDeclContext())
7468+
members.push_back(alternate);
7469+
}
7470+
7471+
if (Impl.SwiftContext.LangOpts.EnableExperimentalConcurrency &&
7472+
!getVersion().supportsConcurrency()) {
7473+
auto asyncVersion = getVersion().withConcurrency(true);
7474+
if (auto asyncImport = Impl.importMirroredDecl(
7475+
objcMethod, dc, asyncVersion, proto)) {
7476+
if (asyncImport != imported)
7477+
members.push_back(asyncImport);
74687478
}
7469-
return true;
7470-
});
7479+
}
7480+
}
74717481
}
74727482
}
74737483

0 commit comments

Comments
 (0)