From 7bd849c2e724453552f9f09df4625e345cdef851 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Thu, 5 Sep 2024 10:24:05 -0400 Subject: [PATCH 1/3] Work around swiftinterface generation bug on Windows. Works around the issue described in https://github.com/swiftlang/swift/issues/76279. --- Sources/Testing/Issues/Issue+Recording.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/Testing/Issues/Issue+Recording.swift b/Sources/Testing/Issues/Issue+Recording.swift index 1f6f210de..2855e7b66 100644 --- a/Sources/Testing/Issues/Issue+Recording.swift +++ b/Sources/Testing/Issues/Issue+Recording.swift @@ -239,7 +239,13 @@ extension Issue { // MARK: - Debugging failures /// A unique value used by ``failureBreakpoint()``. -@usableFromInline @exclusivity(unchecked) nonisolated(unsafe) var failureBreakpointValue = 0 +@usableFromInline +#if !os(Windows) +// Work around compiler bug by not specifying unchecked exclusivity on Windows. +// SEE: https://github.com/swiftlang/swift/issues/76279 +@exclusivity(unchecked) +#endif +nonisolated(unsafe) var failureBreakpointValue = 0 /// A function called by the testing library when a failure occurs. /// @@ -272,5 +278,5 @@ func failureBreakpoint() { // opportunities elsewhere. Instead, this function performs a trivial // operation on a usable-from-inline value, which the compiler must assume // cannot be optimized away. - failureBreakpointValue = 1 + failureBreakpointValue = 0 } From 978259e8f6c1d77fc37f357a0d605a6ade2dd08e Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Thu, 5 Sep 2024 11:04:34 -0400 Subject: [PATCH 2/3] Fix test --- Tests/TestingTests/MiscellaneousTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/TestingTests/MiscellaneousTests.swift b/Tests/TestingTests/MiscellaneousTests.swift index b9f274c8e..4d6984641 100644 --- a/Tests/TestingTests/MiscellaneousTests.swift +++ b/Tests/TestingTests/MiscellaneousTests.swift @@ -531,9 +531,9 @@ struct MiscellaneousTests { @Test("failureBreakpoint() call") func failureBreakpointCall() { - failureBreakpointValue = 0 + failureBreakpointValue = 1 failureBreakpoint() - #expect(failureBreakpointValue == 1) + #expect(failureBreakpointValue == 0) } @available(_clockAPI, *) From ef296515d7bcd0eb9566c2998bd8e0c5eb78ea3d Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Thu, 5 Sep 2024 11:11:57 -0400 Subject: [PATCH 3/3] Reorder attributes --- Sources/Testing/Issues/Issue+Recording.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/Testing/Issues/Issue+Recording.swift b/Sources/Testing/Issues/Issue+Recording.swift index 2855e7b66..fc7129cd9 100644 --- a/Sources/Testing/Issues/Issue+Recording.swift +++ b/Sources/Testing/Issues/Issue+Recording.swift @@ -239,13 +239,12 @@ extension Issue { // MARK: - Debugging failures /// A unique value used by ``failureBreakpoint()``. -@usableFromInline #if !os(Windows) // Work around compiler bug by not specifying unchecked exclusivity on Windows. // SEE: https://github.com/swiftlang/swift/issues/76279 @exclusivity(unchecked) #endif -nonisolated(unsafe) var failureBreakpointValue = 0 +@usableFromInline nonisolated(unsafe) var failureBreakpointValue = 0 /// A function called by the testing library when a failure occurs. ///