From cfcdfe5aa9d66c84e1fadee67e1e1a1ceea1607a Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Mon, 12 Oct 2026 22:15:40 -0500 Subject: [PATCH] Fix Swift 6.2 --- .../Internal/LockIsolated.swift | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/Sources/IssueReporting/Internal/LockIsolated.swift b/Sources/IssueReporting/Internal/LockIsolated.swift index 1a0ebfa..cd31da8 100644 --- a/Sources/IssueReporting/Internal/LockIsolated.swift +++ b/Sources/IssueReporting/Internal/LockIsolated.swift @@ -8,14 +8,27 @@ final class LockIsolated: @unchecked Sendable { init(_ value: sending Value) { self._value = value } - @usableFromInline - func withLock( - _ operation: sending (inout sending Value) throws -> sending T - ) rethrows -> sending T { - lock.lock() - defer { lock.unlock() } - var value = _value - defer { _value = value } - return try operation(&value) - } + #if compiler(>=6.3) + @usableFromInline + func withLock( + _ operation: sending (inout sending Value) throws -> sending T + ) rethrows -> sending T { + lock.lock() + defer { lock.unlock() } + var value = _value + defer { _value = value } + return try operation(&value) + } + #else + @usableFromInline + func withLock( + _ operation: @Sendable (inout Value) throws -> T + ) rethrows -> sending T { + lock.lock() + defer { lock.unlock() } + var value = _value + defer { _value = value } + return try operation(&value) + } + #endif }