@@ -177,32 +177,31 @@ static void emitImplicitValueConstructor(SILGenFunction &SGF,
177
177
fieldTy.getAddressType ());
178
178
InitializationPtr init (new KnownAddressInitialization (slot));
179
179
180
- // An initialized 'let' property has a single value specified by the
181
- // initializer - it doesn't come from an argument.
182
- if (!field->isStatic () && field->isLet () &&
183
- field->getParentInitializer ()) {
180
+ // If it's memberwise initialized, do so now.
181
+ if (field->isMemberwiseInitialized (/* preferDeclaredProperties=*/ false )) {
182
+ assert (elti != eltEnd &&
183
+ " number of args does not match number of fields" );
184
+ (void )eltEnd;
185
+ FullExpr scope (SGF.Cleanups , field->getParentPatternBinding ());
186
+ if (!maybeEmitPropertyDelegateInitFromValue (
187
+ SGF, Loc, field, std::move (*elti),
188
+ [&](Expr *expr) {
189
+ SGF.emitExprInto (expr, init.get ());
190
+ })) {
191
+ std::move (*elti).forwardInto (SGF, Loc, init.get ());
192
+ }
193
+ ++elti;
194
+ } else {
184
195
#ifndef NDEBUG
185
- assert (field->getType ()->isEqual (field->getParentInitializer ()->getType ())
186
- && " Checked by sema" );
196
+ assert (
197
+ field->getType ()->isEqual (field->getParentInitializer ()->getType ())
198
+ && " Checked by sema" );
187
199
#endif
188
200
189
201
// Cleanup after this initialization.
190
202
FullExpr scope (SGF.Cleanups , field->getParentPatternBinding ());
191
203
SGF.emitExprInto (field->getParentInitializer (), init.get ());
192
- continue ;
193
204
}
194
-
195
- assert (elti != eltEnd && " number of args does not match number of fields" );
196
- (void )eltEnd;
197
- FullExpr scope (SGF.Cleanups , field->getParentPatternBinding ());
198
- if (!maybeEmitPropertyDelegateInitFromValue (
199
- SGF, Loc, field, std::move (*elti),
200
- [&](Expr *expr) {
201
- SGF.emitExprInto (expr, init.get ());
202
- })) {
203
- std::move (*elti).forwardInto (SGF, Loc, init.get ());
204
- }
205
- ++elti;
206
205
}
207
206
SGF.B .createReturn (ImplicitReturnLocation::getImplicitReturnLoc (Loc),
208
207
SGF.emitEmptyTuple (Loc));
0 commit comments