Replies: 1 comment 1 reply
-
Hi @pepicrft, this is simply a limitation of let got = await withTaskGroup(of: String.self, returning: String.self) { group in
group.addTask {
utility.value()
}
return await group.first(where: { _ in true })!
} I believe the error message that Swift prints out is quite self-explanatory:
Is there anything in the above that is confusing? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was tinkering with swift-dependencies to understand better the swift-dependencies package to make an informed decision before introducing it in one of my projects, and I came across a "detected illegal task-local value binding" from
TaskLocal
when trying to run a test. It's likely because I need to use the package more effectively, but I'd love to understand why. The example that I was using is this one: ParallelTesting.zip. All I'm doing is:Utility
struct that has a dependency,.identifier
injected using@Dependency
withDependencies
in the test to instantiateUtility
with a different.identifier
value.My goal with that test was to auto-generate a thousand copies of that test to verify if the state is well-scoped, which should be according to this proposal, and that everything works fine in a world with structured and non-structured concurrency. However, I couldn't reach that assessment phase because TaskLocal yields a
detected illegal task-local value binding
error.What am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions