Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 6 Compatibility #12

Merged
merged 8 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import PackageDescription


#if swift(<6)
let swiftConcurrency: SwiftSetting = .enableExperimentalFeature("SwiftConcurrency")
let swiftConcurrency: SwiftSetting = .enableExperimentalFeature("StrictConcurrency")
#else
let swiftConcurrency: SwiftSetting = .enableUpcomingFeature("SwiftConcurrency")
let swiftConcurrency: SwiftSetting = .enableUpcomingFeature("StrictConcurrency")
#endif


Expand Down
4 changes: 2 additions & 2 deletions Tests/SpeziFoundationTests/SharedRepositoryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@
}
}

static var computedValue: Int = 3
static var optionalComputedValue: Int?
static nonisolated(unsafe) var computedValue: Int = 3

Check failure on line 257 in Tests/SpeziFoundationTests/SharedRepositoryTests.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Type Contents Order Violation: An 'instance_property' should not be placed amongst the type content(s) 'type_property' (type_contents_order)
static nonisolated(unsafe) var optionalComputedValue: Int?

private var repos: [AnyTestInstance] = []

Expand Down
2 changes: 2 additions & 0 deletions Tests/SpeziFoundationTests/TimeoutTests.swift
Supereg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
final class TimeoutTests: XCTestCase {
@MainActor private var continuation: CheckedContinuation<Void, any Error>?

@MainActor
func operation(for duration: Duration) {
Task { @MainActor in
try? await Task.sleep(for: duration)
Expand All @@ -26,9 +27,9 @@

@MainActor
func operationMethod(timeout: Duration, operation: Duration, timeoutExpectation: XCTestExpectation) async throws {
async let _ = withTimeout(of: timeout) { @MainActor in

Check warning on line 30 in Tests/SpeziFoundationTests/TimeoutTests.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package macOS / Test using xcodebuild or run fastlane

sending main actor-isolated value of type '@mainactor () async -> Void' with later accesses to nonisolated context risks causing data races; this is an error in the Swift 6 language mode

Check warning on line 30 in Tests/SpeziFoundationTests/TimeoutTests.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package tvOS / Test using xcodebuild or run fastlane

sending main actor-isolated value of type '@mainactor () async -> Void' with later accesses to nonisolated context risks causing data races; this is an error in the Swift 6 language mode

Check warning on line 30 in Tests/SpeziFoundationTests/TimeoutTests.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package visionOS / Test using xcodebuild or run fastlane

sending main actor-isolated value of type '@mainactor () async -> Void' with later accesses to nonisolated context risks causing data races; this is an error in the Swift 6 language mode
timeoutExpectation.fulfill()
if let continuation {

Check warning on line 32 in Tests/SpeziFoundationTests/TimeoutTests.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package iOS / Test using xcodebuild or run fastlane

capture of 'self' with non-sendable type 'TimeoutTests' in 'async let' binding

Check warning on line 32 in Tests/SpeziFoundationTests/TimeoutTests.swift

View workflow job for this annotation

GitHub Actions / Build and Test Swift Package watchOS / Test using xcodebuild or run fastlane

capture of 'self' with non-sendable type 'TimeoutTests' in 'async let' binding
continuation.resume(throwing: TimeoutError())
self.continuation = nil
}
Expand All @@ -40,6 +41,7 @@
}
}

@MainActor
func testTimeout() async throws {
let negativeExpectation = XCTestExpectation()
negativeExpectation.isInverted = true
Expand Down
Loading