[Sema] NFC: Add a variant of addNonIsolatedToSynthesized that checks for @preconcurrency conformances

If derived conformance is marked as `@preconcurrency` instead of
marking synthesized members as `nonisolated` the compiler should
insert dynamic checks.
This commit is contained in:
Pavel Yaskevich
2025-01-14 15:44:57 -08:00
parent fba8095144
commit f10a4819fd
2 changed files with 16 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
#include "TypeCheckObjC.h"
#include "TypeCheckType.h"
#include "TypeChecker.h"
#include "DerivedConformances.h"
#include "swift/AST/ASTMangler.h"
#include "swift/AST/ASTPrinter.h"
#include "swift/AST/AvailabilityInference.h"
@@ -1728,6 +1729,15 @@ bool swift::hasLetStoredPropertyWithInitialValue(NominalTypeDecl *nominal) {
});
}
bool swift::addNonIsolatedToSynthesized(DerivedConformance &derived,
ValueDecl *value) {
if (auto *conformance = derived.Conformance) {
if (conformance && conformance->isPreconcurrency())
return false;
}
return addNonIsolatedToSynthesized(derived.Nominal, value);
}
bool swift::addNonIsolatedToSynthesized(NominalTypeDecl *nominal,
ValueDecl *value) {
if (!getActorIsolation(nominal).isActorIsolated())