[Serialization] Use the correct module for the nested type fast path. (#11018)

Fix-up for 03e1e3b6e, which fixes the crash caused by the new test case.

More https://bugs.swift.org/browse/SR-5284
This commit is contained in:
Jordan Rose
2017-07-18 15:10:18 -07:00
committed by GitHub
parent cab6ec678b
commit adf1e2ef6d
5 changed files with 39 additions and 12 deletions

View File

@@ -1343,9 +1343,13 @@ ModuleFile::resolveCrossReference(ModuleDecl *baseModule, uint32_t pathLen) {
nestedType = containingFile->lookupNestedType(memberName, baseType);
}
} else {
// Fault in extensions, then ask every serialized AST in the module.
// Fault in extensions, then ask every file in the module.
ModuleDecl *extensionModule = M;
if (!extensionModule)
extensionModule = baseType->getModuleContext();
(void)baseType->getExtensions();
for (FileUnit *file : baseType->getModuleContext()->getFiles()) {
for (FileUnit *file : extensionModule->getFiles()) {
if (file == getFile())
continue;
nestedType = file->lookupNestedType(memberName, baseType);