@@ -273,32 +273,6 @@ LookupResult TypeChecker::lookupUnqualified(DeclContext *dc, DeclNameRef name,
273273 return result;
274274}
275275
276- // An unfortunate hack to kick the decl checker into adding semantic members to
277- // the current type before we attempt a semantic lookup. The places this method
278- // looks needs to be in sync with \c extractDirectlyReferencedNominalTypes.
279- // See the note in \c synthesizeSemanticMembersIfNeeded about a better, more
280- // just, and peaceful world.
281- static void installSemanticMembersIfNeeded (Type type, DeclNameRef name) {
282- // Look-through class-bound archetypes to ensure we synthesize e.g.
283- // inherited constructors.
284- if (auto archetypeTy = type->getAs <ArchetypeType>()) {
285- if (auto super = archetypeTy->getSuperclass ()) {
286- type = super;
287- }
288- }
289-
290- if (type->isExistentialType ()) {
291- auto layout = type->getExistentialLayout ();
292- if (auto super = layout.explicitSuperclass ) {
293- type = super;
294- }
295- }
296-
297- if (auto *current = type->getAnyNominal ()) {
298- current->synthesizeSemanticMembersIfNeeded (name.getFullName ());
299- }
300- }
301-
302276LookupResult
303277TypeChecker::lookupUnqualifiedType (DeclContext *dc, DeclNameRef name,
304278 SourceLoc loc,
@@ -346,7 +320,7 @@ LookupResult TypeChecker::lookupMember(DeclContext *dc,
346320 subOptions &= ~NL_RemoveNonVisible;
347321
348322 // Make sure we've resolved implicit members, if we need them.
349- installSemanticMembersIfNeeded (type, name);
323+ namelookup:: installSemanticMembersIfNeeded (type, name);
350324
351325 LookupResultBuilder builder (result, dc, options);
352326 SmallVector<ValueDecl *, 4 > lookupResults;
@@ -438,7 +412,7 @@ LookupTypeResult TypeChecker::lookupMemberType(DeclContext *dc,
438412 subOptions |= NL_IncludeUsableFromInline;
439413
440414 // Make sure we've resolved implicit members, if we need them.
441- installSemanticMembersIfNeeded (type, name);
415+ namelookup:: installSemanticMembersIfNeeded (type, name);
442416
443417 if (!dc->lookupQualified (type, name, subOptions, decls))
444418 return result;
0 commit comments