Skip to content

Commit e5151b3

Browse files
committed
[Sema] Trigger synthesis of type wrapper storage during member lookup
Just like property wrappers and `CodingKeys` trigger type wrapper synthesis in `evaluateMembersRequest`.
1 parent db4b6a5 commit e5151b3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2748,15 +2748,22 @@ static ArrayRef<Decl *> evaluateMembersRequest(
27482748
TypeChecker::checkConformance(conformance->getRootNormalConformance());
27492749
}
27502750

2751-
// If the type conforms to Encodable or Decodable, even via an extension,
2752-
// the CodingKeys enum is synthesized as a member of the type itself.
2753-
// Force it into existence.
27542751
if (nominal) {
2752+
// If the type conforms to Encodable or Decodable, even via an extension,
2753+
// the CodingKeys enum is synthesized as a member of the type itself.
2754+
// Force it into existence.
27552755
(void) evaluateOrDefault(
27562756
ctx.evaluator,
27572757
ResolveImplicitMemberRequest{nominal,
27582758
ImplicitMemberAction::ResolveCodingKeys},
27592759
{});
2760+
2761+
// Synthesize $Storage type and `var $storage` associated with
2762+
// type wrapped type.
2763+
if (nominal->hasTypeWrapper()) {
2764+
(void)nominal->getTypeWrapperStorageDecl();
2765+
(void)nominal->getTypeWrapperProperty();
2766+
}
27602767
}
27612768

27622769
// If the decl has a @main attribute, we need to force synthesis of the

0 commit comments

Comments
 (0)