@@ -4843,21 +4843,19 @@ ProtocolDecl::findProtocolSelfReferences(const ValueDecl *value,
4843
4843
return result;
4844
4844
}
4845
4845
4846
- return ::findProtocolSelfReferences(this , type,
4847
- skipAssocTypes);
4848
- } else if (auto subscript = dyn_cast<SubscriptDecl>(value)) {
4849
- // Check the requirements of a generic subscript.
4850
- if (subscript->isGeneric ()) {
4851
- if (auto result =
4852
- ::findProtocolSelfReferences (this ,
4853
- subscript->getGenericSignature ()))
4854
- return result;
4855
- }
4856
-
4857
4846
return ::findProtocolSelfReferences(this , type,
4858
4847
skipAssocTypes);
4859
4848
} else {
4860
- assert (isa<VarDecl>(value));
4849
+ assert (isa<AbstractStorageDecl>(value));
4850
+
4851
+ if (auto *const subscript = dyn_cast<SubscriptDecl>(value)) {
4852
+ // Check the requirements of a generic subscript.
4853
+ if (subscript->isGeneric ()) {
4854
+ if (auto result = ::findProtocolSelfReferences (
4855
+ this , subscript->getGenericSignature ()))
4856
+ return result;
4857
+ }
4858
+ }
4861
4859
4862
4860
return ::findProtocolSelfReferences (this , type,
4863
4861
skipAssocTypes);
@@ -4875,6 +4873,12 @@ bool ProtocolDecl::isAvailableInExistential(const ValueDecl *decl) const {
4875
4873
if (selfKind.parameter || selfKind.other )
4876
4874
return false ;
4877
4875
4876
+ // FIXME: Appropriately diagnose assignments instead.
4877
+ if (auto *const storageDecl = dyn_cast<AbstractStorageDecl>(decl)) {
4878
+ if (selfKind.result && storageDecl->supportsMutation ())
4879
+ return false ;
4880
+ }
4881
+
4878
4882
return true ;
4879
4883
}
4880
4884
0 commit comments