File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1430,6 +1430,24 @@ void SILGenModule::emitConstructor(ConstructorDecl *decl) {
1430
1430
SILDeclRef constant (decl);
1431
1431
DeclContext *declCtx = decl->getDeclContext ();
1432
1432
1433
+ // Make sure that memberwise initializer of $Storage
1434
+ // in a type wrapped type is always emitted because
1435
+ // it would later be used to initialize $storage property.
1436
+ if (auto *SD = declCtx->getSelfStructDecl ()) {
1437
+ auto &ctx = SD->getASTContext ();
1438
+ if (SD->getName () == ctx.Id_TypeWrapperStorage &&
1439
+ decl->isMemberwiseInitializer ()) {
1440
+ #ifndef NDEBUG
1441
+ auto *wrapped = SD->getDeclContext ()->getSelfNominalTypeDecl ();
1442
+ assert (wrapped->hasTypeWrapper ());
1443
+ #endif
1444
+
1445
+ emitOrDelayFunction (*this , constant,
1446
+ /* forceEmission=*/ true );
1447
+ return ;
1448
+ }
1449
+ }
1450
+
1433
1451
if (declCtx->getSelfClassDecl ()) {
1434
1452
// Designated initializers for classes, as well as @objc convenience
1435
1453
// initializers, have have separate entry points for allocation and
You can’t perform that action at this time.
0 commit comments