Skip to content

Commit d2c831e

Browse files
committed
remove Swift 5.9 support
1 parent edc1929 commit d2c831e

File tree

6 files changed

+16
-49
lines changed

6 files changed

+16
-49
lines changed

FlyingSocks/Sources/SwiftSupport.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
// SOFTWARE.
3030
//
3131

32-
#if compiler(<5.10)
33-
#warning("FlyingFox will soon remove support for Swift 5.9")
32+
#if compiler(<6.0)
33+
#warning("FlyingFox will soon remove support for Swift 5.10")
3434
#endif

FlyingSocks/Tests/IdentifiableContinuationTests.swift

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,40 +219,30 @@ private actor Waiter<T: Sendable, E: Error> {
219219
}
220220

221221
private func addContinuation(_ continuation: Continuation) {
222-
safeAssertIsolated()
222+
assertIsolated()
223223
waiting[continuation.id] = continuation
224224
}
225225

226226
private func resumeID(_ id: Continuation.ID, returning value: T) {
227-
safeAssertIsolated()
227+
assertIsolated()
228228
if let continuation = waiting.removeValue(forKey: id) {
229229
continuation.resume(returning: value)
230230
}
231231
}
232232

233233
private func resumeID(_ id: Continuation.ID, throwing error: E) {
234-
safeAssertIsolated()
234+
assertIsolated()
235235
if let continuation = waiting.removeValue(forKey: id) {
236236
continuation.resume(throwing: error)
237237
}
238238
}
239239

240240
private func resumeID(_ id: Continuation.ID, with result: Result<T, E>) {
241-
safeAssertIsolated()
241+
assertIsolated()
242242
if let continuation = waiting.removeValue(forKey: id) {
243243
continuation.resume(with: result)
244244
}
245245
}
246-
247-
private func safeAssertIsolated() {
248-
#if compiler(>=5.10)
249-
assertIsolated()
250-
#elseif compiler(>=5.9)
251-
if #available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *) {
252-
assertIsolated()
253-
}
254-
#endif
255-
}
256246
}
257247

258248
private extension Actor {

FlyingSocks/XCTests/IdentifiableContinuationTests.swift

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,40 +202,30 @@ private actor Waiter<T: Sendable, E: Error> {
202202
}
203203

204204
private func addContinuation(_ continuation: Continuation) {
205-
safeAssertIsolated()
205+
assertIsolated()
206206
waiting[continuation.id] = continuation
207207
}
208208

209209
private func resumeID(_ id: Continuation.ID, returning value: T) {
210-
safeAssertIsolated()
210+
assertIsolated()
211211
if let continuation = waiting.removeValue(forKey: id) {
212212
continuation.resume(returning: value)
213213
}
214214
}
215215

216216
private func resumeID(_ id: Continuation.ID, throwing error: E) {
217-
safeAssertIsolated()
217+
assertIsolated()
218218
if let continuation = waiting.removeValue(forKey: id) {
219219
continuation.resume(throwing: error)
220220
}
221221
}
222222

223223
private func resumeID(_ id: Continuation.ID, with result: Result<T, E>) {
224-
safeAssertIsolated()
224+
assertIsolated()
225225
if let continuation = waiting.removeValue(forKey: id) {
226226
continuation.resume(with: result)
227227
}
228228
}
229-
230-
private func safeAssertIsolated() {
231-
#if compiler(>=5.10)
232-
assertIsolated()
233-
#elseif compiler(>=5.9)
234-
if #available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *) {
235-
assertIsolated()
236-
}
237-
#endif
238-
}
239229
}
240230

241231
private extension Actor {

FlyingSocks/XCTests/Task+TimeoutTests.swift

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ final class TaskTimeoutTests: XCTestCase {
149149
@MainActor
150150
func testMainActor_ReturnsValue() async throws {
151151
let val = try await withThrowingTimeout(seconds: 1) {
152-
MainActor.safeAssertIsolated()
152+
MainActor.assertIsolated()
153153
try await Task.sleep(nanoseconds: 1_000)
154-
MainActor.safeAssertIsolated()
154+
MainActor.assertIsolated()
155155
return "Fish"
156156
}
157157
XCTAssertEqual(val, "Fish")
@@ -161,8 +161,8 @@ final class TaskTimeoutTests: XCTestCase {
161161
func testMainActorThrowsError_WhenTimeoutExpires() async {
162162
do {
163163
try await withThrowingTimeout(seconds: 0.05) {
164-
MainActor.safeAssertIsolated()
165-
defer { MainActor.safeAssertIsolated() }
164+
MainActor.assertIsolated()
165+
defer { MainActor.assertIsolated() }
166166
try await Task.sleep(nanoseconds: 60_000_000_000)
167167
}
168168
XCTFail("Expected Error")
@@ -262,21 +262,8 @@ private final actor TestActor<T: Sendable> {
262262
func returningValue(after sleep: TimeInterval = 0, timeout: TimeInterval = 1) async throws -> T {
263263
try await withThrowingTimeout(seconds: timeout) {
264264
try await Task.sleep(nanoseconds: UInt64(sleep * 1_000_000_000))
265-
#if compiler(>=5.10)
266265
self.assertIsolated()
267-
#endif
268266
return self.value
269267
}
270268
}
271269
}
272-
273-
private extension MainActor {
274-
275-
static func safeAssertIsolated() {
276-
#if compiler(>=5.10)
277-
assertIsolated()
278-
#else
279-
precondition(Thread.isMainThread)
280-
#endif
281-
}
282-
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.9
1+
// swift-tools-version:5.10
22

33
import PackageDescription
44

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
FlyingFox can be installed by using Swift Package Manager.
2929

30-
**Note:** FlyingFox requires Swift 5.9 on Xcode 15+. It runs on iOS 13+, tvOS 13+, watchOS 8+, macOS 10.15+ and Linux. Android and Windows 10 support is experimental.
30+
**Note:** FlyingFox requires Swift 5.10 on Xcode 15.4+. It runs on iOS 13+, tvOS 13+, watchOS 8+, macOS 10.15+ and Linux. Android and Windows 10 support is experimental.
3131

3232
To install using Swift Package Manager, add this to the `dependencies:` section in your Package.swift file:
3333

0 commit comments

Comments
 (0)