Skip to content

Commit

Permalink
Fix sendable warnings. (#207)
Browse files Browse the repository at this point in the history
* Fix sendable warnings.

* wip

* bring back awaits

* wip
  • Loading branch information
mbrandonw committed Apr 30, 2024
1 parent 7b139d8 commit f79d393
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
11 changes: 0 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,3 @@ let package = Package(
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
)
#endif

//for target in package.targets {
// target.swiftSettings = target.swiftSettings ?? []
// target.swiftSettings?.append(
// .unsafeFlags([
// "-Xfrontend", "-warn-concurrency",
// "-Xfrontend", "-enable-actor-data-race-checks",
// "-enable-library-evolution",
// ])
// )
//}
11 changes: 6 additions & 5 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ let package = Package(
)
#endif

//for target in package.targets {
// target.swiftSettings = target.swiftSettings ?? []
for target in package.targets {
target.swiftSettings = target.swiftSettings ?? []
target.swiftSettings?.append(contentsOf: [
.enableExperimentalFeature("StrictConcurrency")
])
// target.swiftSettings?.append(
// .unsafeFlags([
// "-Xfrontend", "-warn-concurrency",
// "-Xfrontend", "-enable-actor-data-race-checks",
// "-enable-library-evolution",
// ])
// )
//}
}
10 changes: 6 additions & 4 deletions Sources/Dependencies/WithDependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ private class DependencyObjects: @unchecked Sendable {
internal init() {}

func store(_ object: AnyObject) {
self.storage.withValue { storage in
storage[ObjectIdentifier(object)] = DependencyObject(
object: object,
self.storage.withValue { [id = ObjectIdentifier(object), object = UncheckedSendable(object)] storage in
storage[id] = DependencyObject(
object: object.wrappedValue,
dependencyValues: DependencyValues._current
)
Task {
Expand All @@ -347,7 +347,9 @@ private class DependencyObjects: @unchecked Sendable {
.compactMap({ $1 as? _HasInitialValues })
.first?
.initialValues
?? self.storage.withValue({ $0[ObjectIdentifier(object)]?.dependencyValues })
?? self.storage.withValue({ [id = ObjectIdentifier(object)] in
$0[id]?.dependencyValues
})
}
}

Expand Down

0 comments on commit f79d393

Please sign in to comment.