@@ -7153,15 +7153,6 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {
7153
7153
// 'nonisolated' can be applied to global and static/class variables
7154
7154
// that do not have storage.
7155
7155
auto dc = D->getDeclContext ();
7156
- auto &ctx = D->getASTContext ();
7157
-
7158
- if (!ctx.LangOpts .hasFeature (Feature::GlobalActorInferenceCutoff)) {
7159
- if (isa<ProtocolDecl>(D) || isa<ExtensionDecl>(D) || isa<ClassDecl>(D) ||
7160
- isa<StructDecl>(D) || isa<EnumDecl>(D)) {
7161
- diagnoseAndRemoveAttr (attr, diag::invalid_decl_modifier, attr);
7162
- return ;
7163
- }
7164
- }
7165
7156
7166
7157
// nonisolated(unsafe) is unsafe, but only under strict concurrency.
7167
7158
if (attr->isUnsafe () &&
@@ -7184,14 +7175,12 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {
7184
7175
}
7185
7176
}
7186
7177
7187
- if (ctx.LangOpts .hasFeature (Feature::GlobalActorInferenceCutoff)) {
7188
7178
// Additionally, a stored property of a non-'Sendable' type can be
7189
7179
// explicitly marked 'nonisolated'.
7190
7180
if (auto parentDecl = dc->getDeclaredTypeInContext ())
7191
7181
if (!parentDecl->isSendableType ()) {
7192
7182
canBeNonisolated = true ;
7193
7183
}
7194
- }
7195
7184
7196
7185
// Otherwise, this stored property has to be qualified as 'unsafe'.
7197
7186
if (var->supportsMutation () && !attr->isUnsafe () && !canBeNonisolated) {
@@ -7203,15 +7192,12 @@ void AttributeChecker::visitNonisolatedAttr(NonisolatedAttr *attr) {
7203
7192
7204
7193
// 'nonisolated' without '(unsafe)' is not allowed on non-Sendable
7205
7194
// variables, unless they are a member of a non-'Sendable' type.
7206
- if (!attr->isUnsafe () && !type->hasError ()) {
7207
- if (!(canBeNonisolated &&
7208
- ctx.LangOpts .hasFeature (Feature::GlobalActorInferenceCutoff))) {
7209
- bool diagnosed = diagnoseIfAnyNonSendableTypes (
7210
- type, SendableCheckContext (dc), Type (), SourceLoc (),
7211
- attr->getLocation (), diag::nonisolated_non_sendable);
7212
- if (diagnosed)
7213
- return ;
7214
- }
7195
+ if (!attr->isUnsafe () && !type->hasError () && !canBeNonisolated) {
7196
+ bool diagnosed = diagnoseIfAnyNonSendableTypes (
7197
+ type, SendableCheckContext (dc), Type (), SourceLoc (),
7198
+ attr->getLocation (), diag::nonisolated_non_sendable);
7199
+ if (diagnosed)
7200
+ return ;
7215
7201
}
7216
7202
}
7217
7203
0 commit comments