Skip to content

Commit 51716bb

Browse files
committed
[Property wrappers] Validate wrappedValue before using it.
Fixes SR-10984.
1 parent 4e7bcdb commit 51716bb

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
@@ -1601,6 +1601,7 @@ PropertyWrapperBackingPropertyInfoRequest::evaluate(Evaluator &evaluator,
16011601
if (!var->hasInterfaceType()) {
16021602
auto &tc = *static_cast<TypeChecker *>(ctx.getLazyResolver());
16031603
tc.validateDecl(var);
1604+
assert(var->hasInterfaceType());
16041605
}
16051606

16061607
// 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)