Skip to content

Commit 7d0357c

Browse files
committed
[Property wrappers] Validate wrappedValue before using it.
Fixes SR-10984.
1 parent 592887c commit 7d0357c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/Sema/CodeSynthesis.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,7 @@ PropertyWrapperBackingPropertyInfoRequest::evaluate(Evaluator &evaluator,
17241724
if (!var->hasInterfaceType()) {
17251725
auto &tc = *static_cast<TypeChecker *>(ctx.getLazyResolver());
17261726
tc.validateDecl(var);
1727+
assert(var->hasInterfaceType());
17271728
}
17281729

17291730
// Make sure that the property type matches the value of the

lib/Sema/TypeCheckPropertyWrapper.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ PropertyWrapperTypeInfoRequest::evaluate(
265265
.fixItReplace(valueVar->getNameLoc(), "wrappedValue");
266266
}
267267

268+
if (!valueVar->hasInterfaceType())
269+
static_cast<TypeChecker &>(*ctx.getLazyResolver()).validateDecl(valueVar);
270+
268271
PropertyWrapperTypeInfo result;
269272
result.valueVar = valueVar;
270273
result.initialValueInit = findInitialValueInit(ctx, nominal, valueVar);

0 commit comments

Comments
 (0)