@@ -230,7 +230,7 @@ static void collectVisibleMemberDecls(const DeclContext *CurrDC, LookupState LS,
230
230
FoundDecls.push_back (VD);
231
231
};
232
232
233
- for (auto Member : Parent->getMembers ()) {
233
+ for (auto Member : Parent->getAllMembers ()) {
234
234
check (Member);
235
235
Member->visitAuxiliaryDecls ([&](Decl *d) {
236
236
check (d);
@@ -258,28 +258,6 @@ static void doGlobalExtensionLookup(Type BaseType,
258
258
extension)), false ))
259
259
continue ;
260
260
261
- synthesizePropertyWrapperVariables (extension);
262
-
263
- // Expand member macros.
264
- ASTContext &ctx = nominal->getASTContext ();
265
- if (!ctx.evaluator .hasActiveRequest (
266
- ExpandSynthesizedMemberMacroRequest{extension})) {
267
- (void )evaluateOrDefault (
268
- ctx.evaluator ,
269
- ExpandSynthesizedMemberMacroRequest{extension},
270
- false );
271
- }
272
-
273
- // Expand peer macros.
274
- for (auto *member : extension->getMembers ()) {
275
- if (!ctx.evaluator .hasActiveRequest (ExpandPeerMacroRequest{member})) {
276
- (void )evaluateOrDefault (
277
- ctx.evaluator ,
278
- ExpandPeerMacroRequest{member},
279
- {});
280
- }
281
- }
282
-
283
261
collectVisibleMemberDecls (CurrDC, LS, BaseType, extension, FoundDecls);
284
262
}
285
263
@@ -606,52 +584,6 @@ synthesizePropertyWrapperVariables(IterableDeclContext *IDC) {
606
584
}
607
585
}
608
586
609
- // / Trigger synthesizing implicit member declarations to make them "visible".
610
- static void synthesizeMemberDeclsForLookup (NominalTypeDecl *NTD,
611
- const DeclContext *DC) {
612
- // Synthesize the memberwise initializer for structs or default initializer
613
- // for classes.
614
- if (!NTD->getASTContext ().evaluator .hasActiveRequest (
615
- SynthesizeMemberwiseInitRequest{NTD}))
616
- TypeChecker::addImplicitConstructors (NTD);
617
-
618
- // Check all conformances to trigger the synthesized decl generation.
619
- // e.g. init(rawValue:) for RawRepresentable.
620
- for (auto Conformance : NTD->getAllConformances ()) {
621
- auto Proto = Conformance->getProtocol ();
622
- if (!Proto->isAccessibleFrom (DC))
623
- continue ;
624
- auto NormalConformance = dyn_cast<NormalProtocolConformance>(
625
- Conformance->getRootConformance ());
626
- if (!NormalConformance)
627
- continue ;
628
- NormalConformance->forEachTypeWitness (
629
- [](AssociatedTypeDecl *, Type, TypeDecl *) { return false ; },
630
- /* useResolver=*/ true );
631
- NormalConformance->forEachValueWitness ([](ValueDecl *, Witness) {},
632
- /* useResolver=*/ true );
633
- }
634
-
635
- // Expand synthesized member macros.
636
- auto &ctx = NTD->getASTContext ();
637
- if (!ctx.evaluator .hasActiveRequest (
638
- ExpandSynthesizedMemberMacroRequest{NTD})) {
639
- (void )evaluateOrDefault (ctx.evaluator ,
640
- ExpandSynthesizedMemberMacroRequest{NTD},
641
- false );
642
- }
643
-
644
- // Expand extension macros.
645
- if (!ctx.evaluator .hasActiveRequest (
646
- ExpandExtensionMacros{NTD})) {
647
- (void )evaluateOrDefault (ctx.evaluator ,
648
- ExpandExtensionMacros{NTD},
649
- false );
650
- }
651
-
652
- synthesizePropertyWrapperVariables (NTD);
653
- }
654
-
655
587
static void lookupVisibleMemberDeclsImpl (
656
588
Type BaseTy, VisibleDeclConsumer &Consumer, const DeclContext *CurrDC,
657
589
LookupState LS, DeclVisibilityKind Reason, GenericSignature Sig,
@@ -774,20 +706,14 @@ static void lookupVisibleMemberDeclsImpl(
774
706
775
707
auto lookupTy = BaseTy;
776
708
777
- const auto synthesizeAndLookupTypeMembers = [&](NominalTypeDecl *NTD) {
778
- synthesizeMemberDeclsForLookup (NTD, CurrDC);
779
-
780
- // Look in for members of a nominal type.
781
- lookupTypeMembers (BaseTy, lookupTy, Consumer, CurrDC, LS, Reason);
782
- };
783
-
784
709
llvm::SmallPtrSet<ClassDecl *, 8 > Ancestors;
785
710
{
786
711
const auto NTD = BaseTy->getAnyNominal ();
787
712
if (NTD == nullptr )
788
713
return ;
789
714
790
- synthesizeAndLookupTypeMembers (NTD);
715
+ lookupTypeMembers (BaseTy, lookupTy, Consumer, CurrDC, LS, Reason);
716
+
791
717
// Look into protocols only on the current nominal to avoid repeatedly
792
718
// visiting inherited conformances.
793
719
lookupDeclsFromProtocolsBeingConformedTo (BaseTy, Consumer, LS, CurrDC,
@@ -823,7 +749,7 @@ static void lookupVisibleMemberDeclsImpl(
823
749
if (!Ancestors.insert (CurClass).second )
824
750
break ;
825
751
826
- synthesizeAndLookupTypeMembers (CurClass );
752
+ lookupTypeMembers (BaseTy, lookupTy, Consumer, CurrDC, LS, Reason );
827
753
828
754
lookupTy = CurClass->getSuperclass ();
829
755
if (!CurClass->inheritsSuperclassInitializers ())
0 commit comments