Skip to content

Commit 6e2d3fe

Browse files
committed
[AST/TypeChecker] Remove DynamicLookup flag.
We detect whether we’re performing AnyObject lookup based on whether we are looking into AnyObject; these two DynamicLookup flags are unused.
1 parent 4d7e7db commit 6e2d3fe

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

include/swift/AST/LookupKinds.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,25 @@ enum NLOptions : unsigned {
3737
/// Remove overridden declarations from the set of results.
3838
NL_RemoveOverridden = 0x08,
3939

40-
/// For existentials involving the special \c AnyObject protocol,
41-
/// allow lookups to find members of all classes.
42-
NL_DynamicLookup = 0x10,
43-
4440
/// Don't check access when doing lookup into a type.
4541
///
4642
/// This option is not valid when performing lookup into a module.
47-
NL_IgnoreAccessControl = 0x20,
43+
NL_IgnoreAccessControl = 0x10,
4844

4945
/// This lookup is known to be a non-cascading dependency, i.e. one that does
5046
/// not affect downstream files.
5147
///
5248
/// \see NL_KnownDependencyMask
53-
NL_KnownNonCascadingDependency = 0x40,
49+
NL_KnownNonCascadingDependency = 0x20,
5450

5551
/// This lookup is known to be a cascading dependency, i.e. one that can
5652
/// affect downstream files.
5753
///
5854
/// \see NL_KnownDependencyMask
59-
NL_KnownCascadingDependency = 0x80,
55+
NL_KnownCascadingDependency = 0x40,
6056

6157
/// This lookup should only return type declarations.
62-
NL_OnlyTypes = 0x100,
58+
NL_OnlyTypes = 0x80,
6359

6460
/// This lookup is known to not add any additional dependencies to the
6561
/// primary source file.

lib/Sema/TypeCheckDeclOverride.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,6 @@ SmallVector<OverrideMatch, 2> OverrideMatcher::match(
627627
if (members.empty() || name != membersName) {
628628
auto lookupOptions = defaultMemberLookupOptions;
629629

630-
// Class methods cannot override declarations only
631-
// visible via dynamic dispatch.
632-
lookupOptions -= NameLookupFlags::DynamicLookup;
633-
634630
// Class methods cannot override declarations only
635631
// visible as protocol requirements or protocol
636632
// extension members.

lib/Sema/TypeCheckNameLookup.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,6 @@ LookupResult TypeChecker::lookupMember(DeclContext *dc,
370370
NLOptions subOptions = NL_QualifiedDefault;
371371
if (options.contains(NameLookupFlags::KnownPrivate))
372372
subOptions |= NL_KnownNonCascadingDependency;
373-
if (options.contains(NameLookupFlags::DynamicLookup))
374-
subOptions |= NL_DynamicLookup;
375373
if (options.contains(NameLookupFlags::IgnoreAccessControl))
376374
subOptions |= NL_IgnoreAccessControl;
377375

lib/Sema/TypeCheckPattern.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ lookupEnumMemberElement(TypeChecker &TC, DeclContext *DC, Type ty,
132132

133133
// Look up the case inside the enum.
134134
// FIXME: We should be able to tell if this is a private lookup.
135-
NameLookupOptions lookupOptions
136-
= defaultMemberLookupOptions - NameLookupFlags::DynamicLookup;
135+
NameLookupOptions lookupOptions = defaultMemberLookupOptions;
137136
LookupResult foundElements = TC.lookupMember(DC, ty, name, lookupOptions);
138137
return filterForEnumElement(TC, DC, UseLoc,
139138
/*unqualifiedLookup=*/false, foundElements);

lib/Sema/TypeChecker.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,7 @@ inline NameLookupOptions operator|(NameLookupFlags flag1,
309309

310310
/// Default options for member name lookup.
311311
const NameLookupOptions defaultMemberLookupOptions
312-
= NameLookupFlags::DynamicLookup |
313-
NameLookupFlags::ProtocolMembers |
312+
= NameLookupFlags::ProtocolMembers |
314313
NameLookupFlags::PerformConformanceCheck;
315314

316315
/// Default options for constructor lookup.

0 commit comments

Comments
 (0)