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
* Change Outcome conversion to always treat typed failure as Outcome.Erorred (typed failure excludes possibility of external interruption) (#549)
* Treat `Cause.Empty` + external interruption as `Outcome.Canceled`, since this combination manifests sometimes due to a bug in ZIO runtime
* Fix Cause comparison in tests, fix Cogen[Cause] instance
* Compare Cause by converting to Outcome first to ignore Cause tree details not important to cats-effect
* Enable `genFail` and `genCancel` generators since with above fixes the laws pass with them now
* Replace `genRace` and `genParallel` with cats-effect based impls to preserve Outcome when F.canceled is generated
* Add test that `Cause.Fail` cannot be present after external interruption
* Delegate `race` & `both` to default implementations, because `raceFirst` & `zipPar` semantics do not match them
toOutcomeOtherFiber0(actuallyInterrupted)(pure, exit)((e, _) => e, dieCauseToThrowable)
85
+
86
+
@inline private[interop] deftoOutcomeOtherFiber0[F[_], E, E1, A](
87
+
actuallyInterrupted: Boolean
88
+
)(pure: A=>F[A], exit: Exit[E, A])(
89
+
convertFail: (E, Cause[E]) =>E1,
90
+
convertDie: Cause[Nothing] =>E1
91
+
):Outcome[F, E1, A] =
91
92
exit match {
92
-
caseExit.Success(value) =>
93
+
caseExit.Success(value) =>
93
94
Outcome.Succeeded(pure(value))
94
-
caseExit.Failure(cause) if cause.interrupted && actuallyInterrupted =>
95
-
Outcome.Canceled()
96
-
caseExit.Failure(cause) =>
95
+
caseExit.Failure(cause) =>
97
96
cause.failureOrCause match {
98
-
caseLeft(error) =>
99
-
Outcome.Errored(error)
100
-
caseRight(cause) =>
101
-
valcompositeError= dieCauseToThrowable(cause)
102
-
Outcome.Errored(compositeError)
97
+
// if we have a typed failure then we're guaranteed to not be interrupting,
98
+
// typed failure absence is guaranteed by this line https://github.com/zio/zio/blob/22921ee5ac0d2e03531f8b37dfc0d5793a467af8/core/shared/src/main/scala/zio/internal/FiberContext.scala#L415=
99
+
caseLeft(error) =>
100
+
Outcome.Errored(convertFail(error, cause))
101
+
// deem empty cause to be interruption as well, due to occasional invalid ZIO states
102
+
// 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=
103
+
caseRight(cause) if (cause.interrupted || cause.isEmpty) && actuallyInterrupted =>
104
+
Outcome.Canceled()
105
+
caseRight(cause) =>
106
+
Outcome.Errored(convertDie(cause))
103
107
}
104
108
}
105
109
106
110
@inline private[interop] deftoOutcomeCauseThisFiber[R, E, A](
// if we have a typed failure then we're guaranteed to not be interrupting,
129
+
// typed failure absence is guaranteed by this line https://github.com/zio/zio/blob/22921ee5ac0d2e03531f8b37dfc0d5793a467af8/core/shared/src/main/scala/zio/internal/FiberContext.scala#L415=
// deem empty cause to be interruption as well, due to occasional invalid ZIO states
133
+
// 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=
134
+
caseRight(cause) if cause.interrupted || cause.isEmpty =>
// if we have a typed failure then we're guaranteed to not be interrupting,
156
+
// typed failure absence is guaranteed by this line https://github.com/zio/zio/blob/22921ee5ac0d2e03531f8b37dfc0d5793a467af8/core/shared/src/main/scala/zio/internal/FiberContext.scala#L415=
// deem empty cause to be interruption as well, due to occasional invalid ZIO states
162
+
// 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=
163
+
caseRight(cause) if cause.interrupted || cause.isEmpty =>
0 commit comments