mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Representational changes towards get-and-mutableAddress
properties. The main design change here is that, rather than having purportedly orthogonal storage kinds and has-addressor bits, I've merged them into an exhaustive enum of the possibilities. I've also split the observing storage kind into stored-observing and inherited-observing cases, which is possible to do in the parser because the latter are always marked 'override' and the former aren't. This should lead to much better consideration for inheriting observers, which were otherwise very easy to forget about. It also gives us much better recovery when override checking fails before we can identify the overridden declaration; previously, we would end up spuriously considering the override to be a stored property despite the user's clearly expressed intent. Swift SVN r22381
This commit is contained in:
@@ -2981,11 +2981,23 @@ ConstraintSystem::simplifyMemberConstraint(const Constraint &constraint) {
|
||||
// as the getter is nonmutating.
|
||||
if (auto storage = dyn_cast<AbstractStorageDecl>(result)) {
|
||||
auto isGetterMutating = [](AbstractStorageDecl *storage) {
|
||||
if (storage->hasAccessorFunctions())
|
||||
switch (storage->getStorageKind()) {
|
||||
case AbstractStorageDecl::Stored:
|
||||
return false;
|
||||
|
||||
case AbstractStorageDecl::StoredWithObservers:
|
||||
case AbstractStorageDecl::StoredWithTrivialAccessors:
|
||||
case AbstractStorageDecl::InheritedWithObservers:
|
||||
case AbstractStorageDecl::ComputedWithMutableAddress:
|
||||
case AbstractStorageDecl::Computed:
|
||||
case AbstractStorageDecl::AddressedWithTrivialAccessors:
|
||||
case AbstractStorageDecl::AddressedWithObservers:
|
||||
return storage->getGetter()->isMutating();
|
||||
if (storage->hasAddressors())
|
||||
|
||||
case AbstractStorageDecl::Addressed:
|
||||
return storage->getAddressor()->isMutating();
|
||||
return false;
|
||||
}
|
||||
llvm_unreachable("bad storage kind");
|
||||
};
|
||||
|
||||
if (isGetterMutating(storage)) {
|
||||
|
||||
Reference in New Issue
Block a user