Skip to content

Commit

Permalink
Fixes another Xcode 16 beta 6 problem. (#265)
Browse files Browse the repository at this point in the history
* Fixes another Xcode 16 beta 6 problem.

* Revert "Fixes another Xcode 16 beta 6 problem."

This reverts commit cb7eed3.

* wip
  • Loading branch information
mbrandonw authored Aug 26, 2024
1 parent b96f13b commit 1c07db9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
29 changes: 15 additions & 14 deletions Dependencies.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"originHash" : "b78e1fa69770050e204024326b4d77e8451007e7f7ecc1b640d5889ffbe0b3a7",
"pins" : [
{
"identity" : "combine-schedulers",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/combine-schedulers",
"state" : {
"branch" : "swift-testing",
"revision" : "6077442a6ed2826a2209afd6d23cdf3c8d8cfcaf"
"revision" : "9fa31f4403da54855f1e2aeaeff478f4f0e40b13",
"version" : "1.0.2"
}
},
{
"identity" : "swift-clocks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"branch" : "swift-testing",
"revision" : "e0efee21ecbabcc5e15eb0d004701c3a2024adae"
"revision" : "3581e280bf0d90c3fb9236fb23e75a5d8c46b533",
"version" : "1.0.4"
}
},
{
Expand Down Expand Up @@ -45,15 +46,6 @@
"version" : "1.0.0"
}
},
{
"identity" : "swift-issue-reporting",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-issue-reporting",
"state" : {
"revision" : "926f43898706eaa127db79ac42138e1ad7e85a3f",
"version" : "1.2.0"
}
},
{
"identity" : "swift-macro-testing",
"kind" : "remoteSourceControl",
Expand All @@ -80,7 +72,16 @@
"revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c",
"version" : "600.0.0-prerelease-2024-06-12"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "357ca1e5dd31f613a1d43320870ebc219386a495",
"version" : "1.2.2"
}
}
],
"version" : 2
"version" : 3
}
41 changes: 20 additions & 21 deletions Sources/Dependencies/WithDependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ public func withDependencies<R>(
_ updateValuesForOperation: (inout DependencyValues) async throws -> Void,
operation: () async throws -> R
) async rethrows -> R {
try await isSetting(true) {
#if DEBUG
try await DependencyValues.$isSetting.withValue(true) {
var dependencies = DependencyValues._current
try await updateValuesForOperation(&dependencies)
return try await DependencyValues.$_current.withValue(dependencies) {
try await isSetting(false) {
try await DependencyValues.$isSetting.withValue(false) {
let result = try await operation()
if R.self is AnyClass {
dependencyObjects.store(result as AnyObject)
Expand All @@ -78,6 +79,17 @@ public func withDependencies<R>(
}
}
}
#else
var dependencies = DependencyValues._current
try await updateValuesForOperation(&dependencies)
return try await DependencyValues.$_current.withValue(dependencies) {
let result = try await operation()
if R.self is AnyClass {
dependencyObjects.store(result as AnyObject)
}
return result
}
#endif
}
#else
@_unsafeInheritExecutor
Expand Down Expand Up @@ -471,27 +483,14 @@ private func isSetting<R>(
_ value: Bool,
operation: () throws -> R
) rethrows -> R {
#if DEBUG
try DependencyValues.$isSetting.withValue(value, operation: operation)
#else
try operation()
#endif
#if DEBUG
try DependencyValues.$isSetting.withValue(value, operation: operation)
#else
try operation()
#endif
}

#if swift(>=6)
@_transparent
private func isSetting<R>(
_ value: Bool,
isolation: isolated (any Actor)? = #isolation,
operation: () async throws -> R
) async rethrows -> R {
#if DEBUG
try await DependencyValues.$isSetting.withValue(value, operation: operation)
#else
try await operation()
#endif
}
#else
#if swift(<6)
@_transparent
private func isSetting<R>(
_ value: Bool,
Expand Down

0 comments on commit 1c07db9

Please sign in to comment.