You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[6.0] Generated code for XCTest on non-Darwin needs to be actor-isolated. (#7569)
Explanation: Ensure that the synthesized entry point for
swift-corelibs-xctest is concurrency-safe by marking it `@MainActor`.
Scope: All XCTest-based tests built/run on non-Darwin platforms.
Original PR: #7566
Risk: Low. The change is necessary to suppress a concurrency diagnostic.
The synthesized `main()` function is implicitly main-actor-isolated.
Testing: Added unit test to check for the diagnostic, verified it did
not occur anymore with the change in place.
Reviewer: @bnbarham, @MaxDesiatov, @stmontgomery, @briancroom
Copy file name to clipboardExpand all lines: Sources/Build/BuildOperationBuildSystemDelegateHandler.swift
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,7 @@ final class TestDiscoveryCommand: CustomLLBuildCommand, TestBuildCommand {
87
87
88
88
fileprivate extension \#(className){
89
89
@available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
@@ -98,6 +99,7 @@ final class TestDiscoveryCommand: CustomLLBuildCommand, TestBuildCommand {
98
99
content +=
99
100
#"""
100
101
@available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
@@ -166,6 +168,7 @@ final class TestDiscoveryCommand: CustomLLBuildCommand, TestBuildCommand {
166
168
import XCTest
167
169
168
170
@available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
171
+
@MainActor
169
172
public func __allDiscoveredTests() -> [XCTestCaseEntry] {
170
173
\#(testsKeyword)tests = [XCTestCaseEntry]()
171
174
@@ -264,18 +267,15 @@ final class TestEntryPointCommand: CustomLLBuildCommand, TestBuildCommand {
264
267
@main
265
268
@available(*, deprecated, message: "Not actually deprecated. Marked as deprecated to allow inclusion of deprecated tests (which test deprecated functionality) without warnings")
266
269
struct Runner {
267
-
#if os(WASI)
268
-
/// On WASI, we can't block the main thread, so XCTestMain is defined as async.
269
270
static func main() async {
270
271
\#(testObservabilitySetup)
272
+
#if os(WASI)
273
+
/// On WASI, we can't block the main thread, so XCTestMain is defined as async.
0 commit comments