Skip to content

Commit 00bc30c

Browse files
authored
Fix some Swift 6 warnings (#224)
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
1 parent 13de2b8 commit 00bc30c

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ concurrency:
1616
jobs:
1717
macos:
1818
name: macOS
19-
runs-on: macos-13
19+
runs-on: macos-14
2020
strategy:
2121
matrix:
2222
config: ['debug', 'release']
23-
xcode: ['14.3.1', '15.0.1']
23+
xcode: ['14.3.1', '15.4.0']
2424
steps:
2525
- uses: actions/checkout@v4
2626
- name: Select Xcode ${{ matrix.xcode }}
@@ -45,12 +45,19 @@ jobs:
4545
# run: make test-integration
4646

4747
ubuntu:
48-
name: Linux
48+
strategy:
49+
matrix:
50+
swift:
51+
- '5.10'
52+
name: Ubuntu (Swift ${{ matrix.swift }})
4953
runs-on: ubuntu-latest
54+
container: swift:${{ matrix.swift }}
5055
steps:
5156
- uses: actions/checkout@v4
5257
- name: Run tests
53-
run: make test-swift
58+
run: swift test --parallel
59+
- name: Run tests (release)
60+
run: swift test -c release --parallel
5461

5562
# wasm:
5663
# name: Wasm
@@ -75,17 +82,3 @@ jobs:
7582
# run: swift test
7683
# - name: Run tests (release)
7784
# run: swift test -c release
78-
79-
static-stdlib:
80-
strategy:
81-
matrix:
82-
image: ['swift:5.7-focal', 'swift:5.8-focal']
83-
runs-on: ubuntu-latest
84-
container:
85-
image: ${{ matrix.image }}
86-
steps:
87-
- uses: actions/checkout@v4
88-
- name: Build for static-stdlib (debug)
89-
run: swift build -c debug --static-swift-stdlib
90-
- name: Build for static-stdlib (release)
91-
run: swift build -c release --static-swift-stdlib

Sources/Dependencies/Internal/Deprecations.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ extension ActorIsolated {
3030
deprecated,
3131
message: "Use the non-async version of 'withValue'."
3232
)
33-
public func withValue<T>(
33+
public func withValue<T: Sendable>(
3434
_ operation: @Sendable (inout Value) async throws -> T
35-
) async rethrows -> T {
35+
) async rethrows -> T where Value: Sendable {
3636
var value = self.value
3737
defer { self.value = value }
3838
return try await operation(&value)

Sources/Dependencies/Internal/RuntimeWarnings.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ func runtimeWarn(
4343
#endif
4444
}
4545

46-
#if DEBUG
46+
// NB: We can change this to `#if DEBUG` when we drop support for Swift <5.9
47+
#if RELEASE
48+
#else
4749
#if canImport(os)
4850
import Foundation
4951
import os
@@ -53,8 +55,15 @@ func runtimeWarn(
5355
// To work around this, we hook into SwiftUI's runtime issue delivery mechanism, instead.
5456
//
5557
// Feedback filed: https://gist.github.com/stephencelis/a8d06383ed6ccde3e5ef5d1b3ad52bbc
56-
@usableFromInline
57-
let dso = { () -> UnsafeMutableRawPointer in
58+
#if swift(>=5.10)
59+
@usableFromInline
60+
nonisolated(unsafe) let dso = getSwiftUIDSO()
61+
#else
62+
@usableFromInline
63+
let dso = getSwiftUIDSO()
64+
#endif
65+
66+
private func getSwiftUIDSO() -> UnsafeMutableRawPointer {
5867
let count = _dyld_image_count()
5968
for i in 0..<count {
6069
if let name = _dyld_get_image_name(i) {
@@ -67,7 +76,7 @@ func runtimeWarn(
6776
}
6877
}
6978
return UnsafeMutableRawPointer(mutating: #dsohandle)
70-
}()
79+
}
7180
#elseif os(WASI)
7281
#if canImport(JavaScriptCore)
7382
import JavaScriptCore

0 commit comments

Comments
 (0)