@@ -205,6 +205,9 @@ static void collectVisibleMemberDecls(const DeclContext *CurrDC, LookupState LS,
205
205
}
206
206
}
207
207
208
+ static void
209
+ synthesizePropertyWrapperStorageWrapperProperties (IterableDeclContext *IDC);
210
+
208
211
// / Lookup members in extensions of \p LookupType, using \p BaseType as the
209
212
// / underlying type when checking any constraints on the extensions.
210
213
static void doGlobalExtensionLookup (Type BaseType,
@@ -222,6 +225,8 @@ static void doGlobalExtensionLookup(Type BaseType,
222
225
extension)), false ))
223
226
continue ;
224
227
228
+ synthesizePropertyWrapperStorageWrapperProperties (extension);
229
+
225
230
collectVisibleMemberDecls (CurrDC, LS, BaseType, extension, FoundDecls);
226
231
}
227
232
@@ -476,6 +481,20 @@ static void
476
481
lookupTypeMembers (BaseTy, PT, Consumer, CurrDC, LS, Reason);
477
482
}
478
483
484
+ // Generate '$' and '_' prefixed variables that have attached property
485
+ // wrappers.
486
+ static void
487
+ synthesizePropertyWrapperStorageWrapperProperties (IterableDeclContext *IDC) {
488
+ auto SF = IDC->getDecl ()->getDeclContext ()->getParentSourceFile ();
489
+ if (!SF || SF->Kind == SourceFileKind::Interface)
490
+ return ;
491
+
492
+ for (auto Member : IDC->getMembers ())
493
+ if (auto var = dyn_cast<VarDecl>(Member))
494
+ if (var->hasAttachedPropertyWrapper ())
495
+ (void )var->getPropertyWrapperBackingPropertyInfo ();
496
+ }
497
+
479
498
// / Trigger synthesizing implicit member declarations to make them "visible".
480
499
static void synthesizeMemberDeclsForLookup (NominalTypeDecl *NTD,
481
500
const DeclContext *DC) {
@@ -505,22 +524,7 @@ static void synthesizeMemberDeclsForLookup(NominalTypeDecl *NTD,
505
524
}
506
525
}
507
526
508
- // Generate '$' and '_' prefixed variables that have attached property
509
- // wrappers.
510
- auto synthesizePropertyWrappers = [](IterableDeclContext *IDC) {
511
- for (auto Member : IDC->getMembers ()) {
512
- if (auto var = dyn_cast<VarDecl>(Member)) {
513
- if (var->hasAttachedPropertyWrapper ()) {
514
- auto sourceFile = var->getDeclContext ()->getParentSourceFile ();
515
- if (sourceFile && sourceFile->Kind != SourceFileKind::Interface)
516
- (void )var->getPropertyWrapperBackingPropertyInfo ();
517
- }
518
- }
519
- }
520
- };
521
- synthesizePropertyWrappers (NTD);
522
- for (auto ED : NTD->getExtensions ())
523
- synthesizePropertyWrappers (ED);
527
+ synthesizePropertyWrapperStorageWrapperProperties (NTD);
524
528
}
525
529
526
530
static void lookupVisibleMemberDeclsImpl (
0 commit comments