diff --git a/lib/Sema/TypeCheckConcurrency.cpp b/lib/Sema/TypeCheckConcurrency.cpp index cbf4ce670846d..a2f7b47b7e0c0 100644 --- a/lib/Sema/TypeCheckConcurrency.cpp +++ b/lib/Sema/TypeCheckConcurrency.cpp @@ -4445,6 +4445,15 @@ ActorIsolation ActorIsolationRequest::evaluate( if (var->isGlobalStorage() && !isActorType) { auto *diagVar = var; if (auto *originalVar = var->getOriginalWrappedProperty()) { + // temporary 5.10 checking bypass for @TaskLocal + // TODO: @TaskLocal should be a macro + if (auto *classDecl = + var->getInterfaceType()->getClassOrBoundGenericClass()) { + auto &ctx = var->getASTContext(); + if (classDecl == ctx.getTaskLocalDecl()) { + return isolation; + } + } diagVar = originalVar; } if (var->isLet()) { diff --git a/test/Concurrency/task_local.swift b/test/Concurrency/task_local.swift index 0703602a58582..64db42ec86707 100644 --- a/test/Concurrency/task_local.swift +++ b/test/Concurrency/task_local.swift @@ -8,18 +8,14 @@ @available(SwiftStdlib 5.1, *) struct TL { @TaskLocal - static var number: Int = 0 // expected-complete-warning {{static property 'number' is not concurrency-safe because it is non-isolated global shared mutable state; this is an error in Swift 6}} - // expected-complete-note@-1 {{isolate 'number' to a global actor, or convert it to a 'let' constant and conform it to 'Sendable'}} + static var number: Int = 0 @TaskLocal - static var someNil: Int? // expected-complete-warning {{static property 'someNil' is not concurrency-safe because it is non-isolated global shared mutable state; this is an error in Swift 6}} - // expected-complete-note@-1 {{isolate 'someNil' to a global actor, or convert it to a 'let' constant and conform it to 'Sendable'}} + static var someNil: Int? @TaskLocal static var noValue: Int // expected-error{{'static var' declaration requires an initializer expression or an explicitly stated getter}} // expected-note@-1{{add an initializer to silence this error}} - // expected-complete-warning@-2 {{static property 'noValue' is not concurrency-safe because it is non-isolated global shared mutable state; this is an error in Swift 6}} - // expected-complete-note@-3 {{isolate 'noValue' to a global actor, or convert it to a 'let' constant and conform it to 'Sendable'}} @TaskLocal var notStatic: String? // expected-error{{property 'notStatic', must be static because property wrapper 'TaskLocal' can only be applied to static properties}}