mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When performing module lookups, respect the resolution mode when deciding whether or not to validate any found declarations.
Doing so prevents another common source of stack overflows in the validator, and addresses crash suite scenarios 002 and 004. (rdar://problem/18232499, rdar://problem/18232668) Swift SVN r22104
This commit is contained in:
@@ -162,8 +162,14 @@ static void lookupInModule(Module *module, Module::AccessPathTy accessPath,
|
||||
if (respectAccessControl) {
|
||||
auto newEndIter = std::remove_if(localDecls.begin(), localDecls.end(),
|
||||
[=](ValueDecl *VD) {
|
||||
if (typeResolver)
|
||||
typeResolver->resolveDeclSignature(VD);
|
||||
if (typeResolver) {
|
||||
// Do not resolve values in a type context - doing so could potentially
|
||||
// lead to an infinitely recursive validation loop.
|
||||
if ((resolutionKind != ResolutionKind::TypesOnly) ||
|
||||
dyn_cast<TypeDecl>(VD)) {
|
||||
typeResolver->resolveDeclSignature(VD);
|
||||
}
|
||||
}
|
||||
if (!VD->hasAccessibility())
|
||||
return false;
|
||||
return !VD->isAccessibleFrom(moduleScopeContext);
|
||||
|
||||
Reference in New Issue
Block a user