diff --git a/include/swift/AST/DeclContext.h b/include/swift/AST/DeclContext.h index c41eaa46a8b40..d38f1305a8bce 100644 --- a/include/swift/AST/DeclContext.h +++ b/include/swift/AST/DeclContext.h @@ -508,14 +508,6 @@ class alignas(1 << DeclContextAlignInBits) DeclContext { /// FIXME: do this for Protocols, too someday bool canBeParentOfExtension() const; - /// Returns true if lookups within this context could affect downstream files. - /// - /// \param functionsAreNonCascading If true, functions are considered non- - /// cascading contexts. If false, functions are considered non-cascading only - /// if implicitly or explicitly marked private. When concerned only with a - /// function's body, pass true. - bool isCascadingContextForLookup(bool functionsAreNonCascading) const; - /// Look for the set of declarations with the given name within a type, /// its extensions and, optionally, its supertypes. /// diff --git a/lib/AST/ASTScopeLookup.cpp b/lib/AST/ASTScopeLookup.cpp index f25dd0f2071c0..fc08068c8cd69 100644 --- a/lib/AST/ASTScopeLookup.cpp +++ b/lib/AST/ASTScopeLookup.cpp @@ -525,13 +525,9 @@ NullablePtr ASTScopeImpl::ancestorWithDeclSatisfying( #pragma mark ifUnknownIsCascadingUseAccordingTo -static bool isCascadingUseAccordingTo(const DeclContext *const dc) { - return dc->isCascadingContextForLookup(false); -} - static bool ifUnknownIsCascadingUseAccordingTo(Optional isCascadingUse, const DeclContext *const dc) { - return isCascadingUse.getValueOr(isCascadingUseAccordingTo(dc)); + return isCascadingUse.getValueOr(false); } #pragma mark resolveIsCascadingUseForThisScope @@ -550,8 +546,7 @@ Optional GenericParamScope::resolveIsCascadingUseForThisScope( Optional AbstractFunctionDeclScope::resolveIsCascadingUseForThisScope( Optional isCascadingUse) const { - return decl->isCascadingContextForLookup(false) && - isCascadingUse.getValueOr(true); + return false; } Optional AbstractFunctionBodyScope::resolveIsCascadingUseForThisScope( diff --git a/lib/AST/DeclContext.cpp b/lib/AST/DeclContext.cpp index f1cc0b4722107..973f13a9a7fd0 100644 --- a/lib/AST/DeclContext.cpp +++ b/lib/AST/DeclContext.cpp @@ -445,52 +445,6 @@ bool DeclContext::isInnermostContextGeneric() const { return false; } -bool -DeclContext::isCascadingContextForLookup(bool functionsAreNonCascading) const { - // FIXME: This is explicitly checking for attributes in some cases because - // it can be called before access control is computed. - switch (getContextKind()) { - case DeclContextKind::AbstractClosureExpr: - break; - - case DeclContextKind::SerializedLocal: - llvm_unreachable("should not perform lookups in deserialized contexts"); - - case DeclContextKind::Initializer: - // Default arguments still require a type. - if (isa(this)) - return false; - break; - - case DeclContextKind::TopLevelCodeDecl: - // FIXME: Pattern initializers at top-level scope end up here. - return true; - - case DeclContextKind::AbstractFunctionDecl: - if (functionsAreNonCascading) - return false; - break; - - case DeclContextKind::SubscriptDecl: - break; - - case DeclContextKind::EnumElementDecl: - break; - - case DeclContextKind::Module: - case DeclContextKind::FileUnit: - return true; - - case DeclContextKind::GenericTypeDecl: - break; - - case DeclContextKind::ExtensionDecl: - return true; - } - - return getParent()->isCascadingContextForLookup(true); -} - unsigned DeclContext::getSyntacticDepth() const { // Module scope == depth 0. if (isModuleScopeContext()) diff --git a/lib/AST/NameLookupRequests.cpp b/lib/AST/NameLookupRequests.cpp index 876584693c12a..fde7432ea3c6c 100644 --- a/lib/AST/NameLookupRequests.cpp +++ b/lib/AST/NameLookupRequests.cpp @@ -371,18 +371,7 @@ swift::extractNearestSourceLoc(const LookupConformanceDescriptor &desc) { evaluator::DependencySource ModuleQualifiedLookupRequest::readDependencySource( const evaluator::DependencyRecorder &eval) const { auto *DC = std::get<0>(getStorage()); - auto options = std::get<3>(getStorage()); - - // FIXME(Evaluator Incremental Dependencies): This is an artifact of the - // current scheme and should be removed. There are very few callers that are - // accurately passing the right known dependencies mask. - const bool fromPrivateDC = - DC->isCascadingContextForLookup(/*functionsAreNonCascading=*/false); - - auto scope = evaluator::DependencyScope::Cascading; - if (fromPrivateDC) - scope = evaluator::DependencyScope::Private; - return { DC->getParentSourceFile(), scope }; + return { DC->getParentSourceFile(), evaluator::DependencyScope::Private }; } void ModuleQualifiedLookupRequest::writeDependencySink( @@ -453,18 +442,9 @@ void UnqualifiedLookupRequest::writeDependencySink( evaluator::DependencySource QualifiedLookupRequest::readDependencySource( const evaluator::DependencyRecorder &) const { auto *dc = std::get<0>(getStorage()); - auto opts = std::get<3>(getStorage()); - // FIXME(Evaluator Incremental Dependencies): This is an artifact of the - // current scheme and should be removed. There are very few callers that are - // accurately passing the right known dependencies mask. - const bool cascades = - dc->isCascadingContextForLookup(/*functionsAreNonCascading*/ false); - auto scope = evaluator::DependencyScope::Cascading; - if (!cascades) - scope = evaluator::DependencyScope::Private; return { dyn_cast(dc->getModuleScopeContext()), - scope + evaluator::DependencyScope::Private }; }