[Property Wrappers] Inject the opaque value placeholder for a property

wrapper original wrapped value expression inside of CSApply.

This prevents type checking the synthesized backing storage initializer
twice - once with the original expression and again with the placeholder.
This commit is contained in:
Holly Borla
2020-04-03 16:34:33 -07:00
parent c301176ca6
commit bbfcb55e9e
9 changed files with 119 additions and 123 deletions

View File

@@ -4182,9 +4182,11 @@ void SolutionApplicationTarget::maybeApplyPropertyWrapper() {
Expr *backingInitializer;
if (Expr *initializer = expression.expression) {
// Form init(wrappedValue:) call(s).
Expr *wrappedInitializer =
buildPropertyWrapperWrappedValueCall(
singleVar, Type(), initializer, /*ignoreAttributeArgs=*/false);
Expr *wrappedInitializer = buildPropertyWrapperWrappedValueCall(
singleVar, Type(), initializer, /*ignoreAttributeArgs=*/false,
[&](ApplyExpr *innermostInit) {
expression.innermostWrappedValueInit = innermostInit;
});
if (!wrappedInitializer)
return;