Skip to content

Commit 5f62e01

Browse files
authored
Work around swiftinterface generation bug on Windows. (#663)
Works around the issue described in swiftlang/swift#76279. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent 23619cc commit 5f62e01

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Sources/Testing/Issues/Issue+Recording.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,12 @@ extension Issue {
239239
// MARK: - Debugging failures
240240

241241
/// A unique value used by ``failureBreakpoint()``.
242-
@usableFromInline @exclusivity(unchecked) nonisolated(unsafe) var failureBreakpointValue = 0
242+
#if !os(Windows)
243+
// Work around compiler bug by not specifying unchecked exclusivity on Windows.
244+
// SEE: https://github.com/swiftlang/swift/issues/76279
245+
@exclusivity(unchecked)
246+
#endif
247+
@usableFromInline nonisolated(unsafe) var failureBreakpointValue = 0
243248

244249
/// A function called by the testing library when a failure occurs.
245250
///
@@ -272,5 +277,5 @@ func failureBreakpoint() {
272277
// opportunities elsewhere. Instead, this function performs a trivial
273278
// operation on a usable-from-inline value, which the compiler must assume
274279
// cannot be optimized away.
275-
failureBreakpointValue = 1
280+
failureBreakpointValue = 0
276281
}

Tests/TestingTests/MiscellaneousTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,9 @@ struct MiscellaneousTests {
533533

534534
@Test("failureBreakpoint() call")
535535
func failureBreakpointCall() {
536-
failureBreakpointValue = 0
536+
failureBreakpointValue = 1
537537
failureBreakpoint()
538-
#expect(failureBreakpointValue == 1)
538+
#expect(failureBreakpointValue == 0)
539539
}
540540

541541
@available(_clockAPI, *)

0 commit comments

Comments
 (0)