diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6b9e0..ab85d4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes are documented here. The format follows [Keep a Changelog](h ## [Unreleased] +### Tests + +- **The test suite compiles on Swift 6.4 (Xcode 27.0).** 6.4's region-isolation checker rejects two `withTaskCancellationHandler` call sites in `CancellationTests` and `InheritCancellationContextTests` ("passing closure as a `sending` parameter risks causing data races"): the `onCancel` closure implicitly captured a `LockIsolated` counter that the enclosing `model.task { }` closure also uses, and the checker merges the two closures' regions. An explicit `[$count]` / `[$cancelCount]` capture list gives `onCancel` its own copy of the (Sendable) reference and the checker is satisfied. No behavioural change; the library itself already compiled on 6.4 once 1.0.19 landed. + --- ## [1.0.19] — Swift 6.4 `@Model` closure-property compiler crash fix diff --git a/Tests/SwiftModelTests/CancellationTests.swift b/Tests/SwiftModelTests/CancellationTests.swift index bb85f55..0e9b2d0 100644 --- a/Tests/SwiftModelTests/CancellationTests.swift +++ b/Tests/SwiftModelTests/CancellationTests.swift @@ -103,7 +103,7 @@ struct CancellationTests { // Using a long sleep so the task cannot complete naturally before being cancelled. await inHandler.send(()) try await Task.sleep(nanoseconds: nanosPerSecond * 60) - } onCancel: { + } onCancel: { [$count] in $count.wrappedValue += 1 } $count.wrappedValue += 5 diff --git a/Tests/SwiftModelTests/InheritCancellationContextTests.swift b/Tests/SwiftModelTests/InheritCancellationContextTests.swift index 3db6c43..5a6cbfc 100644 --- a/Tests/SwiftModelTests/InheritCancellationContextTests.swift +++ b/Tests/SwiftModelTests/InheritCancellationContextTests.swift @@ -45,7 +45,7 @@ struct InheritCancellationContextTests { // This guarantees cancelAll below fires onCancel synchronously. await inHandler.send(()) try await Task.sleep(nanoseconds: nanosPerSecond * 60) - } onCancel: { + } onCancel: { [$cancelCount] in $cancelCount.wrappedValue += 1 } } catch: { _ in }