Skip to content

Commit f7b366c

Browse files
committed
[Sema] TypeWrappers: Don't try to manage compiler synthesized properties
Properties like `unownedExecutor` that are implicitly injected into a type should not be managed by a type wrapper.
1 parent 04f1cde commit f7b366c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/Sema/CodeSynthesis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ static ConstructorDecl *createImplicitConstructor(NominalTypeDecl *decl,
381381
continue;
382382

383383
if (!var->isAccessedViaTypeWrapper()) {
384-
// $_storage itself.
385-
if (var->getName() == ctx.Id_TypeWrapperProperty)
384+
// Compiler synthesized properties are not included.
385+
if (var->isImplicit())
386386
continue;
387387

388388
// Computed properties are not included.

lib/Sema/TypeCheckTypeWrapper.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,6 @@ bool IsPropertyAccessedViaTypeWrapper::evaluate(Evaluator &evaluator,
312312
if (!(parent && parent->hasTypeWrapper()))
313313
return false;
314314

315-
// Don't attempt to wrap the `$_storage` property.
316-
if (property->getName() == property->getASTContext().Id_TypeWrapperProperty)
317-
return false;
318-
319315
if (property->isStatic() || property->isLet())
320316
return false;
321317

@@ -346,6 +342,11 @@ bool IsPropertyAccessedViaTypeWrapper::evaluate(Evaluator &evaluator,
346342
return true;
347343
}
348344

345+
// Don't wrap any compiler synthesized properties except to
346+
// property wrapper backing storage (checked above).
347+
if (property->isImplicit())
348+
return false;
349+
349350
// Check whether this is a computed property.
350351
{
351352
auto declaresAccessor = [&](ArrayRef<AccessorKind> kinds) -> bool {

0 commit comments

Comments
 (0)