Sema: Avoid adding nonisolated twice to synthesized Hashable methods.

https://github.com/apple/swift/pull/42041 introduced a centralized mechanism for adding the `nonisolated` attribute to synthesized decls but did not clean up the existing code that was already doing so for `Hashable` conformances.

Resolves rdar://102106591
This commit is contained in:
Allan Shortlidge
2022-11-08 14:54:05 -08:00
parent 0592979c34
commit 7782f862c0
4 changed files with 31 additions and 15 deletions

View File

@@ -1605,13 +1605,14 @@ bool swift::hasLetStoredPropertyWithInitialValue(NominalTypeDecl *nominal) {
});
}
void swift::addNonIsolatedToSynthesized(
NominalTypeDecl *nominal, ValueDecl *value) {
bool swift::addNonIsolatedToSynthesized(NominalTypeDecl *nominal,
ValueDecl *value) {
if (!getActorIsolation(nominal).isActorIsolated())
return;
return false;
ASTContext &ctx = nominal->getASTContext();
value->getAttrs().add(new (ctx) NonisolatedAttr(/*isImplicit=*/true));
return true;
}
static std::pair<BraceStmt *, /*isTypeChecked=*/bool>