diff --git a/Package.swift b/Package.swift index c3fc8820..4e01726c 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.6 +// swift-tools-version: 5.7 import PackageDescription diff --git a/Sources/Clocks/AnyClock.swift b/Sources/Clocks/AnyClock.swift index ace96939..f9f8cfd6 100644 --- a/Sources/Clocks/AnyClock.swift +++ b/Sources/Clocks/AnyClock.swift @@ -1,4 +1,4 @@ -#if swift(>=5.7) && (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) +#if (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) /// A type-erased clock. /// /// This type provides a concrete alternative to `any Clock` and makes it possible to diff --git a/Sources/Clocks/ImmediateClock.swift b/Sources/Clocks/ImmediateClock.swift index 6ecee1e5..ab76a0bb 100644 --- a/Sources/Clocks/ImmediateClock.swift +++ b/Sources/Clocks/ImmediateClock.swift @@ -1,4 +1,4 @@ -#if swift(>=5.7) && (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) +#if (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) import ConcurrencyExtras import Foundation diff --git a/Sources/Clocks/Internal/_AsyncTimerSequence.swift b/Sources/Clocks/Internal/_AsyncTimerSequence.swift index a5315eac..a4ce9909 100644 --- a/Sources/Clocks/Internal/_AsyncTimerSequence.swift +++ b/Sources/Clocks/Internal/_AsyncTimerSequence.swift @@ -1,4 +1,4 @@ -#if swift(>=5.7) && (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) +#if (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) //===----------------------------------------------------------------------===// // // This source file is part of the Swift Async Algorithms open source project diff --git a/Sources/Clocks/Shims.swift b/Sources/Clocks/Shims.swift deleted file mode 100644 index 5737704d..00000000 --- a/Sources/Clocks/Shims.swift +++ /dev/null @@ -1,17 +0,0 @@ -#if swift(>=5.7) && (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) && swift(<5.9) - @available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) - extension Clock { - /// Suspends for the given duration. - /// - /// This method should be provided by the standard library, but it is not yet included. See this - /// proposal for more information: - /// - @_disfavoredOverload - public func sleep( - for duration: Duration, - tolerance: Duration? = nil - ) async throws { - try await self.sleep(until: self.now.advanced(by: duration), tolerance: tolerance) - } - } -#endif diff --git a/Sources/Clocks/SwiftUI.swift b/Sources/Clocks/SwiftUI.swift index d6b1a243..6c299dac 100644 --- a/Sources/Clocks/SwiftUI.swift +++ b/Sources/Clocks/SwiftUI.swift @@ -1,4 +1,4 @@ -#if swift(>=5.7) && (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) && canImport(SwiftUI) +#if (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) && canImport(SwiftUI) import SwiftUI @available(macOS 13, iOS 16, watchOS 9, tvOS 16, *) diff --git a/Sources/Clocks/TestClock.swift b/Sources/Clocks/TestClock.swift index 3b586c94..0cda3855 100644 --- a/Sources/Clocks/TestClock.swift +++ b/Sources/Clocks/TestClock.swift @@ -1,4 +1,4 @@ -#if swift(>=5.7) && (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) +#if (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) import ConcurrencyExtras import Foundation import XCTestDynamicOverlay diff --git a/Sources/Clocks/Timer.swift b/Sources/Clocks/Timer.swift index 5e1cfe46..24e36291 100644 --- a/Sources/Clocks/Timer.swift +++ b/Sources/Clocks/Timer.swift @@ -1,4 +1,4 @@ -#if swift(>=5.7) && (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) +#if (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) @available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) extension Clock where Duration: Hashable { /// Creates an async sequence that emits the clock's `now` value on an interval. diff --git a/Sources/Clocks/UnimplementedClock.swift b/Sources/Clocks/UnimplementedClock.swift index 5b5a210a..2dd06da9 100644 --- a/Sources/Clocks/UnimplementedClock.swift +++ b/Sources/Clocks/UnimplementedClock.swift @@ -1,4 +1,4 @@ -#if swift(>=5.7) && (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) +#if (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst)) import ConcurrencyExtras import Foundation import XCTestDynamicOverlay diff --git a/Tests/ClocksTests/ShimTests.swift b/Tests/ClocksTests/ShimTests.swift deleted file mode 100644 index 52f9ae5c..00000000 --- a/Tests/ClocksTests/ShimTests.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Clocks -import XCTest - -@available(iOS 16, macOS 13, tvOS 16, watchOS 9, *) -final class ShimTests: XCTestCase { - func testClockSleepFor() async { - let testClock = TestClock() - let clock: some Clock = testClock - - let isFinished = ActorIsolated(false) - Task { - try await clock.sleep(for: .seconds(1)) - await isFinished.setValue(true) - } - - var checkIsFinished = await isFinished.value - XCTAssertEqual(checkIsFinished, false) - - await testClock.advance(by: .seconds(1)) - checkIsFinished = await isFinished.value - XCTAssertEqual(checkIsFinished, true) - } -}