You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix#541#509 respect finalizer in Async#async implementation #542#542
* Always convert non-interrupt failures to Outcome.Errored. Define standard Concurrent/Temporal instances only for Throwable error. Define generic Concurrent/Temporal as operating on Cause[E] errors to be able to wrap non-interrupt errors to Outcome.Errored. #543#543
* Fix#503 implement MonadCancel#canceled by sending an external interrupt to current fiber via Fiber.unsafeCurrentFiber #544#544
* Outcome conversion and test fixes#549#549
* Fix CatsInteropSpec, redefine toOutcome for ZIO2 - ZIO2 _DOES_ preserve typed errors in the same Cause as external interruptions, so previous definition was incorrect
There remain test failures in 'canceled sequences onCancel in order' – they are occur when `genOfRace`/`genOfParallel` or `genCancel` occurs, so something might still be wrong with outcome conversion in these case
OR there may be bugs in ZIO 2 (or some more tricky behavior)
* Remove todos
* Update to ZIO 2.0.1
* Remove genNever
* Update eqForUIO
* Revert Update eqForUIO
* Disable the 'onCancel associates over uncancelable boundary' law test
* Add some tracing
* Add todo comment
Co-authored-by: Kai <450507+neko-kai@users.noreply.github.com>
toOutcomeOtherFiber0(actuallyInterrupted)(pure, exit)((e, _) => e, dieCauseToThrowable)
77
+
78
+
@inline private[interop] deftoOutcomeOtherFiber0[F[_], E, E1, A](
79
+
actuallyInterrupted: Boolean
80
+
)(pure: A=>F[A], exit: Exit[E, A])(
81
+
convertFail: (E, Cause[E]) =>E1,
82
+
convertDie: Cause[Nothing] =>E1
83
+
):Outcome[F, E1, A] =
84
+
exit match {
85
+
caseExit.Success(value) =>
86
+
Outcome.Succeeded(pure(value))
87
+
caseExit.Failure(cause) =>
88
+
// ZIO 2, unlike ZIO 1, _does not_ guarantee that the presence of a typed failure
89
+
// means we're NOT interrupting, so we have to check for interruption to matter what
90
+
if (
91
+
(cause.isInterrupted || {
92
+
// deem empty cause to be interruption as well, due to occasional invalid ZIO states
93
+
// in `ZIO.fail().uninterruptible` caused by this line https://github.com/zio/zio/blob/22921ee5ac0d2e03531f8b37dfc0d5793a467af8/core/shared/src/main/scala/zio/internal/FiberContext.scala#L415=
94
+
// NOTE: this line is for ZIO 1, it may not apply for ZIO 2, someone needs to debunk
95
+
// whether this is required
96
+
cause.isEmpty
97
+
}) && actuallyInterrupted
98
+
) {
99
+
Outcome.Canceled()
100
+
} else {
101
+
cause.failureOrCause match {
102
+
caseLeft(error) =>
103
+
Outcome.Errored(convertFail(error, cause))
104
+
caseRight(cause) =>
105
+
Outcome.Errored(convertDie(cause))
106
+
}
107
+
}
108
+
}
109
+
110
+
@inline private[interop] deftoOutcomeCauseThisFiber[R, E, A](
28
111
exit: Exit[E, A]
29
-
)(implicittrace: Trace):Outcome[ZIO[R, E, _], E, A] =
// ZIO 2, unlike ZIO 1, _does not_ guarantee that the presence of a typed failure
134
+
// means we're NOT interrupting, so we have to check for interruption to matter what
135
+
if (
136
+
cause.isInterrupted || {
137
+
// deem empty cause to be interruption as well, due to occasional invalid ZIO states
138
+
// in `ZIO.fail().uninterruptible` caused by this line https://github.com/zio/zio/blob/22921ee5ac0d2e03531f8b37dfc0d5793a467af8/core/shared/src/main/scala/zio/internal/FiberContext.scala#L415=
139
+
// NOTE: this line is for ZIO 1, it may not apply for ZIO 2, someone needs to debunk
// ZIO 2, unlike ZIO 1, _does not_ guarantee that the presence of a typed failure
170
+
// means we're NOT interrupting, so we have to check for interruption to matter what
171
+
if (
172
+
cause.isInterrupted || {
173
+
// deem empty cause to be interruption as well, due to occasional invalid ZIO states
174
+
// in `ZIO.fail().uninterruptible` caused by this line https://github.com/zio/zio/blob/22921ee5ac0d2e03531f8b37dfc0d5793a467af8/core/shared/src/main/scala/zio/internal/FiberContext.scala#L415=
175
+
// NOTE: this line is for ZIO 1, it may not apply for ZIO 2, someone needs to debunk
@inline private[interop] defsignalOnNoExternalInterrupt[R, E, A](
204
+
f: ZIO[R, E, A]
205
+
)(notInterrupted: UIO[Unit]):ZIO[R, E, A] =
206
+
f.onExit {
207
+
caseExit.Success(_)=>ZIO.unit
208
+
caseExit.Failure(_) =>
209
+
// we don't check if cause is interrupted
210
+
// because we can get an invalid state Cause.empty
211
+
// due to this line https://github.com/zio/zio/blob/22921ee5ac0d2e03531f8b37dfc0d5793a467af8/core/shared/src/main/scala/zio/internal/FiberContext.scala#L415=
212
+
// if the last error was an uninterruptible typed error
0 commit comments