mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SR-2673: @NSManaged property can't satisfy protocol requirement (#5141)
Targeted fix for SR-2673: if a potential protocol witness is @NSManaged, add accessors the NSManaged way, not the stored property way. There's probably more weirdness around here, so I'll clone the bug to go through maybeAddAccessorsToVariable a lot more often. (Lazy properties could easily be broken in the same way.)
This commit is contained in:
@@ -820,7 +820,10 @@ void TypeChecker::synthesizeAccessorsForStorage(AbstractStorageDecl *storage,
|
||||
// If the decl is stored, convert it to StoredWithTrivialAccessors
|
||||
// by synthesizing the full set of accessors.
|
||||
if (!storage->hasAccessorFunctions()) {
|
||||
addTrivialAccessorsToStorage(storage, *this);
|
||||
if (storage->getAttrs().hasAttribute<NSManagedAttr>())
|
||||
maybeAddAccessorsToVariable(cast<VarDecl>(storage), *this);
|
||||
else
|
||||
addTrivialAccessorsToStorage(storage, *this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user