diff --git a/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala b/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala index 942ca23e2d..6df21f4786 100644 --- a/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala +++ b/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala @@ -731,7 +731,7 @@ sealed abstract class Resource[F[_], +A] extends Serializable { Resource.applyFull[F, Either[Throwable, A]] { poll => poll(allocatedCase).attempt.map { case Right((a, r)) => (a.asRight[Throwable], r) - case error => (error, _ => F.unit) + case error => (error.asInstanceOf[Either[Throwable, A]], _ => F.unit) } }