From 3f1018f8eaac49dadd513e97c7c39f53a4722c61 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 17 Sep 2025 11:10:46 -0400 Subject: [PATCH 1/3] Remove a workaround for varargs not compiling on WASI. This PR removes a workaround on WASI where we were avoiding a call to `withVaList()` because it miscompiled there. That problem was fixed by https://github.com/swiftlang/swift/pull/84029 and cherry-picked to 6.2. --- Sources/Testing/Events/TimeValue.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Sources/Testing/Events/TimeValue.swift b/Sources/Testing/Events/TimeValue.swift index 838eb381b..649aef2a4 100644 --- a/Sources/Testing/Events/TimeValue.swift +++ b/Sources/Testing/Events/TimeValue.swift @@ -81,10 +81,6 @@ extension TimeValue: Codable {} extension TimeValue: CustomStringConvertible { var description: String { -#if os(WASI) - // BUG: https://github.com/swiftlang/swift/issues/72398 - return String(describing: Duration(self)) -#else let (secondsFromAttoseconds, attosecondsRemaining) = attoseconds.quotientAndRemainder(dividingBy: 1_000_000_000_000_000_000) let seconds = seconds + secondsFromAttoseconds var milliseconds = attosecondsRemaining / 1_000_000_000_000_000 @@ -98,7 +94,6 @@ extension TimeValue: CustomStringConvertible { } return String(cString: buffer.baseAddress!) } -#endif } } From 5f41d74ef791055a0c1962f4d4a4f7169cd0551e Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 17 Sep 2025 11:20:52 -0400 Subject: [PATCH 2/3] Revert "Remove a workaround for varargs not compiling on WASI." This reverts commit 3f1018f8eaac49dadd513e97c7c39f53a4722c61. --- Sources/Testing/Events/TimeValue.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/Testing/Events/TimeValue.swift b/Sources/Testing/Events/TimeValue.swift index 649aef2a4..838eb381b 100644 --- a/Sources/Testing/Events/TimeValue.swift +++ b/Sources/Testing/Events/TimeValue.swift @@ -81,6 +81,10 @@ extension TimeValue: Codable {} extension TimeValue: CustomStringConvertible { var description: String { +#if os(WASI) + // BUG: https://github.com/swiftlang/swift/issues/72398 + return String(describing: Duration(self)) +#else let (secondsFromAttoseconds, attosecondsRemaining) = attoseconds.quotientAndRemainder(dividingBy: 1_000_000_000_000_000_000) let seconds = seconds + secondsFromAttoseconds var milliseconds = attosecondsRemaining / 1_000_000_000_000_000 @@ -94,6 +98,7 @@ extension TimeValue: CustomStringConvertible { } return String(cString: buffer.baseAddress!) } +#endif } } From 64659ac054367d39d58a778afc2f7340a6838e74 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 17 Sep 2025 11:21:12 -0400 Subject: [PATCH 3/3] Restore the workaround but only for 6.2 --- Sources/Testing/Events/TimeValue.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Testing/Events/TimeValue.swift b/Sources/Testing/Events/TimeValue.swift index 838eb381b..ddc454f7b 100644 --- a/Sources/Testing/Events/TimeValue.swift +++ b/Sources/Testing/Events/TimeValue.swift @@ -81,7 +81,7 @@ extension TimeValue: Codable {} extension TimeValue: CustomStringConvertible { var description: String { -#if os(WASI) +#if os(WASI) && compiler(<6.3) // BUG: https://github.com/swiftlang/swift/issues/72398 return String(describing: Duration(self)) #else