Skip to content

Commit d7a1a01

Browse files
committed
Fix test case.
The specific problem was that the AST was looking for Actor/AnyActor in _Concurrency... but I named the module of the test borrowing (for some reason). So the machinery was failing to think that my stubbed out protocols where the true known protocols. By changing the module name to _Concurrency, everything worked out. (cherry picked from commit 4aea60c)
1 parent 8304ceb commit d7a1a01

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

test/Concurrency/transfernonsendable_global_actor_nonsendable.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ extension NonSendableGlobalActorIsolatedStruct {
101101

102102
mutating func test3() -> transferring NonSendableKlass {
103103
self.k
104-
} // expected-error {{sending 'self.k' may cause a data race}}
104+
} // expected-error {{sending 'self.k' risks causing data races}}
105105
// expected-note @-1 {{main actor-isolated 'self.k' cannot be a transferring result. main actor-isolated uses may race with caller uses}}
106106

107107
mutating func test4() -> (any GlobalActorIsolatedProtocol)? {
@@ -166,7 +166,7 @@ extension NonSendableGlobalActorIsolatedEnum {
166166
return nil
167167
}
168168
return x
169-
} // expected-error {{sending 'x.some' may cause a data race}}
169+
} // expected-error {{sending 'x.some' risks causing data races}}
170170
// expected-note @-1 {{main actor-isolated 'x.some' cannot be a transferring result. main actor-isolated uses may race with caller uses}}
171171
}
172172

@@ -181,7 +181,7 @@ extension NonSendableGlobalActorIsolatedKlass {
181181

182182
func test3() -> transferring NonSendableKlass {
183183
self.k
184-
} // expected-error {{sending 'self.k' may cause a data race}}
184+
} // expected-error {{sending 'self.k' risks causing data races}}
185185
// expected-note @-1 {{main actor-isolated 'self.k' cannot be a transferring result. main actor-isolated uses may race with caller uses}}
186186

187187
func test4() -> (any GlobalActorIsolatedProtocol)? {
@@ -214,7 +214,7 @@ extension FinalNonSendableGlobalActorIsolatedKlass {
214214

215215
func test3() -> transferring NonSendableKlass {
216216
self.k
217-
} // expected-error {{sending 'self.k' may cause a data race}}
217+
} // expected-error {{sending 'self.k' risks causing data races}}
218218
// expected-note @-1 {{main actor-isolated 'self.k' cannot be a transferring result. main actor-isolated uses may race with caller uses}}
219219

220220
func test4() -> (any GlobalActorIsolatedProtocol)? {
@@ -247,7 +247,7 @@ extension GlobalActorIsolatedProtocol {
247247

248248
mutating func test3() -> transferring NonSendableKlass {
249249
self.k
250-
} // expected-error {{sending 'self.k' may cause a data race}}
250+
} // expected-error {{sending 'self.k' risks causing data races}}
251251
// expected-note @-1 {{main actor-isolated 'self.k' cannot be a transferring result. main actor-isolated uses may race with caller uses}}
252252

253253
mutating func test4() -> (any GlobalActorIsolatedProtocol)? {

test/SIL/Serialization/isolated_parameters.sil

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-sil-opt %s -emit-sib -o %t/tmp.sib -module-name borrow
3-
// RUN: %target-sil-opt %t/tmp.sib -o %t/tmp.2.sib -module-name borrow
4-
// RUN: %target-sil-opt %t/tmp.2.sib -module-name borrow -emit-sorted-sil | %FileCheck %s
2+
// RUN: %target-sil-opt %s -emit-sib -o %t/tmp.sib -module-name _Concurrency
3+
// RUN: %target-sil-opt %t/tmp.sib -o %t/tmp.2.sib -module-name _Concurrency
4+
// RUN: %target-sil-opt %t/tmp.2.sib -module-name _Concurrency -emit-sorted-sil | %FileCheck %s
55

66
// REQUIRES: asserts
77
// REQUIRES: concurrency
@@ -13,6 +13,7 @@ import Swift
1313
import SwiftShims
1414

1515
// NOTE: In SIL we do not save/print out imports, so we cannot import _Concurrency here!
16+
1617
public protocol AnyActor: AnyObject, Sendable {}
1718
public protocol Actor : AnyActor {}
1819

0 commit comments

Comments
 (0)