Skip to content

Commit 296af88

Browse files
authored
Merge pull request swiftlang#74624 from xedin/concurrency-incorrect-placement-of-static-property-error-6.0
[6.0][Concurrency] Don't attempt to diagnose `GlobalConcurrency` issues wi…
2 parents 2b4f85e + 02faa8f commit 296af88

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5131,7 +5131,11 @@ ActorIsolation ActorIsolationRequest::evaluate(
51315131
// isolated to a global actor.
51325132
auto checkGlobalIsolation = [var = dyn_cast<VarDecl>(value)](
51335133
ActorIsolation isolation) {
5134-
if (var && var->getLoc() &&
5134+
// Diagnose only declarations in the same module.
5135+
//
5136+
// TODO: This should be factored out from ActorIsolationRequest into
5137+
// either ActorIsolationChecker or DeclChecker.
5138+
if (var && var->getLoc(/*SerializedOK*/false) &&
51355139
var->getASTContext().LangOpts.hasFeature(Feature::GlobalConcurrency) &&
51365140
!isolation.isGlobalActor() &&
51375141
(isolation != ActorIsolation::NonisolatedUnsafe)) {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/src)
3+
// RUN: %empty-directory(%t/lib)
4+
// RUN: split-file %s %t/src
5+
6+
/// Build the library
7+
// RUN: %target-swift-frontend -emit-module %t/src/Lib.swift \
8+
// RUN: -module-name Lib -swift-version 5 \
9+
// RUN: -enable-library-evolution \
10+
// RUN: -emit-module-interface-path %t/lib/Lib.swiftinterface \
11+
// RUN: -emit-module-path %t/lib/Lib.swiftmodule \
12+
// RUN: -emit-module-source-info-path %t/lib/Lib.swiftsourceinfo
13+
14+
// Build the client
15+
// RUN: %target-swift-frontend -typecheck -primary-file %t/src/Client.swift \
16+
// RUN: -module-name Client -I %t/lib \
17+
// RUN: -swift-version 6
18+
19+
// REQUIRES: asserts
20+
// REQUIRES: concurrency
21+
22+
//--- Lib.swift
23+
24+
public struct Test: Equatable {
25+
public static let value = Test(x: 0)
26+
27+
public var x: UInt64
28+
29+
private init(x: UInt64) {
30+
self.x = x
31+
}
32+
}
33+
34+
//--- Client.swift
35+
import Lib
36+
37+
public func test() -> Test {
38+
.value // Ok (no sendability errors)
39+
}

0 commit comments

Comments
 (0)