mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Sema] TypeWrappers: Subsume property init before injecting it into $Storage
It was done in `maybeAddTypeWrapperDefaultArg` before because user-defined initializers weren't supported but now property initializers need to be subsumed earlier to make sure that SILGen doesn't try to emit them into user-defined initializers.
This commit is contained in:
committed by
Pavel Yaskevich
parent
73e9f27968
commit
24b2bcae09
@@ -213,20 +213,6 @@ static void maybeAddTypeWrapperDefaultArg(ParamDecl *arg, VarDecl *var,
|
||||
if (!initExpr)
|
||||
return;
|
||||
|
||||
// Type wrapper variables are never initialized directly,
|
||||
// initialization expression (if any) becomes an default
|
||||
// argument of the initializer synthesized by the type wrapper.
|
||||
{
|
||||
// Since type wrapper is applied to backing property, that's
|
||||
// the the initializer it subsumes.
|
||||
if (var->hasAttachedPropertyWrapper()) {
|
||||
auto *backingVar = var->getPropertyWrapperBackingProperty();
|
||||
PBD = backingVar->getParentPatternBinding();
|
||||
}
|
||||
|
||||
PBD->setInitializerSubsumed(/*index=*/0);
|
||||
}
|
||||
|
||||
arg->setDefaultExpr(initExpr, PBD->isInitializerChecked(/*index=*/0));
|
||||
arg->setDefaultArgumentKind(DefaultArgumentKind::Normal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user