mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Recover from failures in ModuleFile::lookupClassMembers
Access to a missing member on an AnyObject triggers a typo correction that looks at all class members in imported modules. Make sure it recovers from deserializing members referencing implementation-only imported types. rdar://79427805
This commit is contained in:
@@ -794,7 +794,13 @@ void ModuleFile::lookupClassMembers(ImportPath::Access accessPath,
|
||||
if (!accessPath.empty()) {
|
||||
for (const auto &list : Core->ClassMembersForDynamicLookup->data()) {
|
||||
for (auto item : list) {
|
||||
auto vd = cast<ValueDecl>(getDecl(item.second));
|
||||
auto decl = getDeclChecked(item.second);
|
||||
if (!decl) {
|
||||
llvm::consumeError(decl.takeError());
|
||||
continue;
|
||||
}
|
||||
|
||||
auto vd = cast<ValueDecl>(decl.get());
|
||||
auto dc = vd->getDeclContext();
|
||||
while (!dc->getParent()->isModuleScopeContext())
|
||||
dc = dc->getParent();
|
||||
@@ -808,10 +814,17 @@ void ModuleFile::lookupClassMembers(ImportPath::Access accessPath,
|
||||
}
|
||||
|
||||
for (const auto &list : Core->ClassMembersForDynamicLookup->data()) {
|
||||
for (auto item : list)
|
||||
consumer.foundDecl(cast<ValueDecl>(getDecl(item.second)),
|
||||
for (auto item : list) {
|
||||
auto decl = getDeclChecked(item.second);
|
||||
if (!decl) {
|
||||
llvm::consumeError(decl.takeError());
|
||||
continue;
|
||||
}
|
||||
|
||||
consumer.foundDecl(cast<ValueDecl>(decl.get()),
|
||||
DeclVisibilityKind::DynamicLookup,
|
||||
DynamicLookupInfo::AnyObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user