Make sure we validate the synthesized accessors for NSManaged properties.

(as well as those for lazy properties, which seem to be working already)

This fixes a problem with @NSManaged properties being declared in an
extension in a generated file you're not supposed to modify, which
unfortunately is exactly how Xcode's generating them these days.

rdar://problem/20821582

Swift SVN r28180
This commit is contained in:
Jordan Rose
2015-05-05 20:02:12 +00:00
parent edf1958f86
commit 88c9ab591f
3 changed files with 27 additions and 2 deletions

View File

@@ -1569,6 +1569,9 @@ static void convertNSManagedStoredVarToComputed(VarDecl *VD, TypeChecker &TC) {
// Okay, we have both the getter and setter. Set them in VD.
VD->makeComputed(VD->getLoc(), Get, Set, nullptr, VD->getLoc());
TC.validateDecl(Get);
TC.validateDecl(Set);
// We've added some members to our containing class/extension, add them to
// the members list.
addMemberToContextIfNeeded(Get, VD->getDeclContext());
@@ -1840,7 +1843,9 @@ void swift::maybeAddAccessorsToVariable(VarDecl *var, TypeChecker &TC) {
var->makeComputed(var->getLoc(), getter, setter, nullptr,
var->getLoc());
var->setIsBeingTypeChecked(false);
TC.computeAccessibility(setter);
TC.validateDecl(getter);
TC.validateDecl(setter);
addMemberToContextIfNeeded(getter, var->getDeclContext());
addMemberToContextIfNeeded(setter, var->getDeclContext());