Skip to content

Commit ec4c17a

Browse files
committed
Sema: Remove NameLookupFlags::PerformConformanceCheck
1 parent 397e36a commit ec4c17a

File tree

2 files changed

+5
-34
lines changed

2 files changed

+5
-34
lines changed

lib/Sema/TypeCheckNameLookup.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ namespace {
124124

125125
assert(isa<ProtocolDecl>(foundDC));
126126

127-
if (!Options.contains(NameLookupFlags::PerformConformanceCheck))
128-
return;
129-
130127
// If we found something within the protocol itself, and our
131128
// search began somewhere that is not in a protocol or extension
132129
// thereof, remap this declaration to the witness.
@@ -434,21 +431,7 @@ LookupTypeResult TypeChecker::lookupMemberType(DeclContext *dc,
434431
if (auto assocType = dyn_cast<AssociatedTypeDecl>(typeDecl)) {
435432
if (!type->is<ArchetypeType>() &&
436433
!type->isTypeParameter()) {
437-
if (options.contains(NameLookupFlags::PerformConformanceCheck))
438-
inferredAssociatedTypes.push_back(assocType);
439-
continue;
440-
}
441-
}
442-
443-
// FIXME: This is a hack, we should be able to remove this entire 'if'
444-
// statement once we learn how to deal with the circularity here.
445-
if (auto *aliasDecl = dyn_cast<TypeAliasDecl>(typeDecl)) {
446-
if (isa<ProtocolDecl>(aliasDecl->getDeclContext()) &&
447-
!type->is<ArchetypeType>() &&
448-
!type->isTypeParameter() &&
449-
aliasDecl->getUnderlyingType()->getCanonicalType()
450-
->hasTypeParameter() &&
451-
!options.contains(NameLookupFlags::PerformConformanceCheck)) {
434+
inferredAssociatedTypes.push_back(assocType);
452435
continue;
453436
}
454437
}

lib/Sema/TypeChecker.h

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,6 @@ enum class NameLookupFlags {
190190
KnownPrivate = 0x01,
191191
/// Whether name lookup should be able to find protocol members.
192192
ProtocolMembers = 0x02,
193-
/// Whether we should map the requirement to the witness if we
194-
/// find a protocol member and the base type is a concrete type.
195-
///
196-
/// If this is not set but ProtocolMembers is set, we will
197-
/// find protocol extension members, but not protocol requirements
198-
/// that do not yet have a witness (such as inferred associated
199-
/// types, or witnesses for derived conformances).
200-
PerformConformanceCheck = 0x04,
201193
/// Whether to perform 'dynamic' name lookup that finds @objc
202194
/// members of any class or protocol.
203195
DynamicLookup = 0x08,
@@ -221,23 +213,19 @@ inline NameLookupOptions operator|(NameLookupFlags flag1,
221213

222214
/// Default options for member name lookup.
223215
const NameLookupOptions defaultMemberLookupOptions
224-
= NameLookupFlags::ProtocolMembers |
225-
NameLookupFlags::PerformConformanceCheck;
216+
= NameLookupFlags::ProtocolMembers;
226217

227218
/// Default options for constructor lookup.
228219
const NameLookupOptions defaultConstructorLookupOptions
229-
= NameLookupFlags::ProtocolMembers |
230-
NameLookupFlags::PerformConformanceCheck;
220+
= NameLookupFlags::ProtocolMembers;
231221

232222
/// Default options for member type lookup.
233223
const NameLookupOptions defaultMemberTypeLookupOptions
234-
= NameLookupFlags::ProtocolMembers |
235-
NameLookupFlags::PerformConformanceCheck;
224+
= NameLookupFlags::ProtocolMembers;
236225

237226
/// Default options for unqualified name lookup.
238227
const NameLookupOptions defaultUnqualifiedLookupOptions
239-
= NameLookupFlags::ProtocolMembers |
240-
NameLookupFlags::PerformConformanceCheck;
228+
= NameLookupFlags::ProtocolMembers;
241229

242230
/// Describes the result of comparing two entities, of which one may be better
243231
/// or worse than the other, or they are unordered.

0 commit comments

Comments
 (0)