-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…rrupt to current fiber via `Fiber.unsafeCurrentFiber` (#544) * Workaround zio/zio#6911 Only consider the *current* fiber being interrupted as `Outcome.Canceled`, consider internal interruption & Die to be `Outcome.Errored` Trigger `MonadCancel#onCancel` only if the *current* fiber is being interrupted Implement `MonadCancel#bracketFull` & `bracketCase` * Fix #503 Find a way to send interrupt to self via `Fiber.unsafeCurrentFiber`, implement external-only Cancel semantic for `start` and `raceWith` * make `MonadError#onError` consistent with `guaranteeCase` starting from `MonadCancel` instance * Add tests for zio/zio#6911 (require #543) * Fix js implementation of `async` * arbitrary instance: convert from cats-effect * rebase * Use throwable instead of generic instance in `ZManaged#toResource[F]` * Remove exceptions for inner interruption in generic error instances & generate Interrupted Causes for generic tests * In tests, add more generators + cats conversion generators - disabled by default, because they surface further law failures still * Fix `calls finalizers when using resource is canceled` test, fix unreliability of `canceled` when used with `unsafeRunToFuture` * Change `toEffect` implementation to avoid getting a `BoxedException` when the underlying fiber is interrupted. * Relax condition for signalling non-interruption, because ZIO sometimes creates invalid Causes without Interrupt node when interrupted * Add `genNever` to random generators * Change the implementation of `Async#async` to follow `async left is uncancelable sequenced raiseError` law. Consider the law code: ```scala // format: off def asyncLeftIsUncancelableSequencedRaiseError[A](e: Throwable, fu: F[Unit]) = (F.async[A](k => F.delay(k(Left(e))) >> fu.as(None)) <* F.unit) <-> (F.uncancelable(_ => fu) >> F.raiseError(e)) // format: on ``` if `fu` is `F.never`, then an implmentation based on ZIO.effectAsyncM can never satisfy this law, because it runs the register code on a separate fiber and ignores its effect. The law clearly states that register effect must run first and must run on the same fiber as the callback listener, so as to supercede it. * 2.12 build * Remove incorrect `onError` definition. (should not be uncancelable) * Remove redundant `resetForkScope` * Acknowledge `onError`/`Outcome.Errored` incoherence in tests * Restore no-op F.onError in `parTraverse + ZIO.die` test
- Loading branch information
Showing
10 changed files
with
530 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.