@@ -1194,7 +1194,7 @@ static void lookupVisibleDeclsImpl(VisibleDeclConsumer &Consumer,
11941194 if (!isa<PatternBindingInitializer>(DC) ||
11951195 !cast<PatternBindingInitializer>(DC)->getInitializedLazyVar ())
11961196 LS = LS.withOnMetatype ();
1197- DC = DC->getParent ();
1197+ DC = DC->getParentForLookup ();
11981198 }
11991199
12001200 // We don't look for generic parameters if we are in the context of a
@@ -1210,7 +1210,7 @@ static void lookupVisibleDeclsImpl(VisibleDeclConsumer &Consumer,
12101210
12111211 if (auto *SE = dyn_cast<SubscriptDecl>(DC)) {
12121212 ExtendedType = SE->getDeclContext ()->getSelfTypeInContext ();
1213- DC = DC->getParent ();
1213+ DC = DC->getParentForLookup ();
12141214 if (SE->isStatic ())
12151215 LS = LS.withOnMetatype ();
12161216 } else if (auto *AFD = dyn_cast<AbstractFunctionDecl>(DC)) {
@@ -1238,7 +1238,7 @@ static void lookupVisibleDeclsImpl(VisibleDeclConsumer &Consumer,
12381238
12391239 if (AFD->getDeclContext ()->isTypeContext ()) {
12401240 ExtendedType = AFD->getDeclContext ()->getSelfTypeInContext ();
1241- DC = DC->getParent ();
1241+ DC = DC->getParentForLookup ();
12421242
12431243 if (auto *FD = dyn_cast<FuncDecl>(AFD))
12441244 if (FD->isStatic ())
@@ -1288,7 +1288,7 @@ static void lookupVisibleDeclsImpl(VisibleDeclConsumer &Consumer,
12881288 MemberReason = DeclVisibilityKind::MemberOfOutsideNominal;
12891289 }
12901290
1291- DC = DC->getParent ();
1291+ DC = DC->getParentForLookup ();
12921292 }
12931293
12941294 if (auto SF = dyn_cast<SourceFile>(DC)) {
0 commit comments