From 1a079458611f4428fe5d195dd850e7868d49757d Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 10 Sep 2023 11:02:41 +0900 Subject: [PATCH 1/2] add explicit type --- .../src/main/scala/cats/effect/IOFiber.scala | 3 ++- .../main/scala/cats/effect/kernel/Async.scala | 10 +++++----- .../main/scala/cats/effect/kernel/Clock.scala | 18 ++++++++++-------- .../scala/cats/effect/kernel/GenTemporal.scala | 10 +++++----- .../scala/cats/effect/kernel/Resource.scala | 8 ++++---- .../main/scala/cats/effect/kernel/Sync.scala | 14 +++++++------- .../scala/cats/effect/laws/AsyncTests.scala | 5 +++-- .../scala/cats/effect/laws/ClockTests.scala | 4 ++-- .../scala/cats/effect/laws/GenSpawnTests.scala | 5 +++-- .../cats/effect/laws/GenTemporalTests.scala | 5 +++-- .../cats/effect/laws/MonadCancelTests.scala | 3 ++- .../scala/cats/effect/laws/SyncTests.scala | 3 ++- .../scala/cats/effect/laws/UniqueTests.scala | 4 ++-- .../cats/effect/IOPlatformSpecification.scala | 2 +- .../cats/effect/std/DeferredJVMSpec.scala | 4 ++-- .../src/test/scala/cats/effect/IOSpec.scala | 6 ++++-- 16 files changed, 57 insertions(+), 47 deletions(-) diff --git a/core/shared/src/main/scala/cats/effect/IOFiber.scala b/core/shared/src/main/scala/cats/effect/IOFiber.scala index 039f73c3cb..f574b0894d 100644 --- a/core/shared/src/main/scala/cats/effect/IOFiber.scala +++ b/core/shared/src/main/scala/cats/effect/IOFiber.scala @@ -527,7 +527,8 @@ private final class IOFiber[A]( masks += 1 val id = masks val poll = new Poll[IO] { - def apply[B](ioa: IO[B]) = IO.Uncancelable.UnmaskRunLoop(ioa, id, IOFiber.this) + def apply[B](ioa: IO[B]): IO[B] = + IO.Uncancelable.UnmaskRunLoop(ioa, id, IOFiber.this) } val next = diff --git a/kernel/shared/src/main/scala/cats/effect/kernel/Async.scala b/kernel/shared/src/main/scala/cats/effect/kernel/Async.scala index 25a1599928..32be6cddeb 100644 --- a/kernel/shared/src/main/scala/cats/effect/kernel/Async.scala +++ b/kernel/shared/src/main/scala/cats/effect/kernel/Async.scala @@ -406,7 +406,7 @@ object Async { implicit protected def F: Async[F] override protected final def delegate = super.delegate - override protected final def C = F + override protected final def C: Clock[F] = F override def unique: OptionT[F, Unique.Token] = delay(new Unique.Token()) @@ -477,7 +477,7 @@ object Async { implicit protected def F: Async[F] override protected final def delegate = super.delegate - override protected final def C = F + override protected final def C: Clock[F] = F override def unique: EitherT[F, E, Unique.Token] = delay(new Unique.Token()) @@ -549,7 +549,7 @@ object Async { implicit protected def F: Async[F] override protected final def delegate = super.delegate - override protected final def C = F + override protected final def C: Clock[F] = F override def unique: IorT[F, L, Unique.Token] = delay(new Unique.Token()) @@ -620,7 +620,7 @@ object Async { implicit protected def F: Async[F] override protected final def delegate = super.delegate - override protected final def C = F + override protected final def C: Clock[F] = F override def unique: WriterT[F, L, Unique.Token] = delay(new Unique.Token()) @@ -688,7 +688,7 @@ object Async { implicit protected def F: Async[F] override protected final def delegate = super.delegate - override protected final def C = F + override protected final def C: Clock[F] = F override def unique: Kleisli[F, R, Unique.Token] = delay(new Unique.Token()) diff --git a/kernel/shared/src/main/scala/cats/effect/kernel/Clock.scala b/kernel/shared/src/main/scala/cats/effect/kernel/Clock.scala index a77ad08ba3..2fdef6645b 100644 --- a/kernel/shared/src/main/scala/cats/effect/kernel/Clock.scala +++ b/kernel/shared/src/main/scala/cats/effect/kernel/Clock.scala @@ -64,7 +64,7 @@ object Clock { implicit F0: Monad[F], C0: Clock[F]): Clock[OptionT[F, *]] = new OptionTClock[F] { - def applicative = OptionT.catsDataMonadForOptionT(F) + def applicative: Applicative[OptionT[F, *]] = OptionT.catsDataMonadForOptionT(F) implicit override def F: Monad[F] = F0 implicit override def C: Clock[F] = C0 } @@ -73,7 +73,7 @@ object Clock { implicit F0: Monad[F], C0: Clock[F]): Clock[EitherT[F, E, *]] = new EitherTClock[F, E] { - def applicative = EitherT.catsDataMonadErrorForEitherT(F) + def applicative: Applicative[EitherT[F, E, *]] = EitherT.catsDataMonadErrorForEitherT(F) implicit override def F: Monad[F] = F0 implicit override def C: Clock[F] = C0 } @@ -82,7 +82,8 @@ object Clock { implicit F0: Monad[F], C0: Clock[F]): Clock[StateT[F, S, *]] = new StateTClock[F, S] { - def applicative = IndexedStateT.catsDataMonadForIndexedStateT(F) + def applicative: Applicative[IndexedStateT[F, S, S, *]] = + IndexedStateT.catsDataMonadForIndexedStateT(F) implicit override def F: Monad[F] = F0 implicit override def C: Clock[F] = C0 } @@ -92,7 +93,7 @@ object Clock { C0: Clock[F], L0: Monoid[L]): Clock[WriterT[F, L, *]] = new WriterTClock[F, L] { - def applicative = WriterT.catsDataMonadForWriterT(F, L) + def applicative: Applicative[WriterT[F, L, *]] = WriterT.catsDataMonadForWriterT(F, L) implicit override def F: Monad[F] = F0 implicit override def C: Clock[F] = C0 @@ -105,7 +106,7 @@ object Clock { C0: Clock[F], L0: Semigroup[L]): Clock[IorT[F, L, *]] = new IorTClock[F, L] { - def applicative = IorT.catsDataMonadErrorForIorT(F, L) + def applicative: Applicative[IorT[F, L, *]] = IorT.catsDataMonadErrorForIorT(F, L) implicit override def F: Monad[F] = F0 implicit override def C: Clock[F] = C0 @@ -116,7 +117,7 @@ object Clock { implicit F0: Monad[F], C0: Clock[F]): Clock[Kleisli[F, R, *]] = new KleisliClock[F, R] { - def applicative = Kleisli.catsDataMonadForKleisli(F) + def applicative: Applicative[Kleisli[F, R, *]] = Kleisli.catsDataMonadForKleisli(F) implicit override def F: Monad[F] = F0 implicit override def C: Clock[F] = C0 } @@ -126,7 +127,7 @@ object Clock { C0: Clock[F], D0: Defer[F]): Clock[ContT[F, R, *]] = new ContTClock[F, R] { - def applicative = ContT.catsDataContTMonad(D) + def applicative: Applicative[ContT[F, R, *]] = ContT.catsDataContTMonad(D) implicit override def F: Monad[F] = F0 implicit override def C: Clock[F] = C0 implicit override def D: Defer[F] = D0 @@ -137,7 +138,8 @@ object Clock { C0: Clock[F], L0: Monoid[L]): Clock[ReaderWriterStateT[F, R, L, S, *]] = new ReaderWriterStateTClock[F, R, L, S] { - def applicative = IndexedReaderWriterStateT.catsDataMonadForRWST(F, L) + def applicative: Applicative[ReaderWriterStateT[F, R, L, S, *]] = + IndexedReaderWriterStateT.catsDataMonadForRWST(F, L) implicit override def F: Monad[F] = F0 implicit override def C: Clock[F] = C0 diff --git a/kernel/shared/src/main/scala/cats/effect/kernel/GenTemporal.scala b/kernel/shared/src/main/scala/cats/effect/kernel/GenTemporal.scala index 305cf8ece2..27cdacbf68 100644 --- a/kernel/shared/src/main/scala/cats/effect/kernel/GenTemporal.scala +++ b/kernel/shared/src/main/scala/cats/effect/kernel/GenTemporal.scala @@ -310,7 +310,7 @@ object GenTemporal { with Clock.OptionTClock[F] { implicit protected def F: GenTemporal[F, E] - protected def C = F + protected def C: Clock[F] = F override protected def delegate: MonadError[OptionT[F, *], E] = OptionT.catsDataMonadErrorForOptionT[F, E] @@ -325,7 +325,7 @@ object GenTemporal { with Clock.EitherTClock[F, E0] { implicit protected def F: GenTemporal[F, E] - protected def C = F + protected def C: Clock[F] = F override protected def delegate: MonadError[EitherT[F, E0, *], E] = EitherT.catsDataMonadErrorFForEitherT[F, E, E0] @@ -339,7 +339,7 @@ object GenTemporal { with Clock.IorTClock[F, L] { implicit protected def F: GenTemporal[F, E] - protected def C = F + protected def C: Clock[F] = F override protected def delegate: MonadError[IorT[F, L, *], E] = IorT.catsDataMonadErrorFForIorT[F, L, E] @@ -353,7 +353,7 @@ object GenTemporal { with Clock.WriterTClock[F, L] { implicit protected def F: GenTemporal[F, E] - protected def C = F + protected def C: Clock[F] = F implicit protected def L: Monoid[L] @@ -369,7 +369,7 @@ object GenTemporal { with Clock.KleisliClock[F, R] { implicit protected def F: GenTemporal[F, E] - protected def C = F + protected def C: Clock[F] = F override protected def delegate: MonadError[Kleisli[F, R, *], E] = Kleisli.catsDataMonadErrorForKleisli[F, R, E] 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 36dfeb07d4..b93f73cce5 100644 --- a/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala +++ b/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala @@ -1223,7 +1223,7 @@ private[effect] trait ResourceHOInstances0 extends ResourceHOInstances1 { implicit def catsEffectAsyncForResource[F[_]](implicit F0: Async[F]): Async[Resource[F, *]] = new ResourceAsync[F] { def F = F0 - override def applicative = this + override def applicative: ResourceAsync[F] = this } implicit def catsEffectSemigroupKForResource[F[_], A]( @@ -1242,7 +1242,7 @@ private[effect] trait ResourceHOInstances1 extends ResourceHOInstances2 { implicit F0: Temporal[F]): Temporal[Resource[F, *]] = new ResourceTemporal[F] { def F = F0 - override def applicative = this + override def applicative: Applicative[Resource[F, *]] = this } implicit def catsEffectSyncForResource[F[_]](implicit F0: Sync[F]): Sync[Resource[F, *]] = @@ -1257,7 +1257,7 @@ private[effect] trait ResourceHOInstances2 extends ResourceHOInstances3 { implicit F0: Concurrent[F]): Concurrent[Resource[F, *]] = new ResourceConcurrent[F] { def F = F0 - override def applicative = this + override def applicative: ResourceConcurrent[F] = this } implicit def catsEffectClockForResource[F[_]]( @@ -1430,7 +1430,7 @@ abstract private[effect] class ResourceAsync[F[_]] with Async[Resource[F, *]] { self => implicit protected def F: Async[F] - override def applicative = this + override def applicative: ResourceAsync[F] = this override def unique: Resource[F, Unique.Token] = Resource.unique diff --git a/kernel/shared/src/main/scala/cats/effect/kernel/Sync.scala b/kernel/shared/src/main/scala/cats/effect/kernel/Sync.scala index 68ad11ef65..dc63120be7 100644 --- a/kernel/shared/src/main/scala/cats/effect/kernel/Sync.scala +++ b/kernel/shared/src/main/scala/cats/effect/kernel/Sync.scala @@ -214,7 +214,7 @@ object Sync { with Clock.OptionTClock[F] { implicit protected def F: Sync[F] - protected def C = F + protected def C: Clock[F] = F def suspend[A](hint: Type)(thunk: => A): OptionT[F, A] = OptionT.liftF(F.suspend(hint)(thunk)) @@ -225,7 +225,7 @@ object Sync { with MonadCancel.EitherTMonadCancel[F, E, Throwable] with Clock.EitherTClock[F, E] { implicit protected def F: Sync[F] - protected def C = F + protected def C: Clock[F] = F def suspend[A](hint: Type)(thunk: => A): EitherT[F, E, A] = EitherT.liftF(F.suspend(hint)(thunk)) @@ -236,7 +236,7 @@ object Sync { with MonadCancel.StateTMonadCancel[F, S, Throwable] with Clock.StateTClock[F, S] { implicit protected def F: Sync[F] - protected def C = F + protected def C: Clock[F] = F def suspend[A](hint: Type)(thunk: => A): StateT[F, S, A] = StateT.liftF(F.suspend(hint)(thunk)) @@ -247,7 +247,7 @@ object Sync { with MonadCancel.WriterTMonadCancel[F, S, Throwable] with Clock.WriterTClock[F, S] { implicit protected def F: Sync[F] - protected def C = F + protected def C: Clock[F] = F def suspend[A](hint: Type)(thunk: => A): WriterT[F, S, A] = WriterT.liftF(F.suspend(hint)(thunk)) @@ -258,7 +258,7 @@ object Sync { with MonadCancel.IorTMonadCancel[F, L, Throwable] with Clock.IorTClock[F, L] { implicit protected def F: Sync[F] - protected def C = F + protected def C: Clock[F] = F def suspend[A](hint: Type)(thunk: => A): IorT[F, L, A] = IorT.liftF(F.suspend(hint)(thunk)) @@ -269,7 +269,7 @@ object Sync { with MonadCancel.KleisliMonadCancel[F, R, Throwable] with Clock.KleisliClock[F, R] { implicit protected def F: Sync[F] - protected def C = F + protected def C: Clock[F] = F def suspend[A](hint: Type)(thunk: => A): Kleisli[F, R, A] = Kleisli.liftF(F.suspend(hint)(thunk)) @@ -280,7 +280,7 @@ object Sync { with MonadCancel.ReaderWriterStateTMonadCancel[F, R, L, S, Throwable] with Clock.ReaderWriterStateTClock[F, R, L, S] { implicit protected def F: Sync[F] - protected def C = F + protected def C: Clock[F] = F def suspend[A](hint: Type)(thunk: => A): ReaderWriterStateT[F, R, L, S, A] = ReaderWriterStateT.liftF(F.suspend(hint)(thunk)) diff --git a/laws/shared/src/main/scala/cats/effect/laws/AsyncTests.scala b/laws/shared/src/main/scala/cats/effect/laws/AsyncTests.scala index 45bbedd57f..7b1bbd7de1 100644 --- a/laws/shared/src/main/scala/cats/effect/laws/AsyncTests.scala +++ b/laws/shared/src/main/scala/cats/effect/laws/AsyncTests.scala @@ -24,6 +24,7 @@ import cats.laws.discipline.SemigroupalTests.Isomorphisms import org.scalacheck._ import org.scalacheck.Prop.forAll import org.scalacheck.util.Pretty +import org.typelevel.discipline.Laws import scala.concurrent.ExecutionContext import scala.concurrent.duration.FiniteDuration @@ -84,7 +85,7 @@ trait AsyncTests[F[_]] extends GenTemporalTests[F, Throwable] with SyncTests[F] new RuleSet { val name = "async" - val bases = Nil + val bases: Seq[(String, Laws#RuleSet)] = Nil val parents = Seq( temporal[A, B, C]( tolerance, @@ -194,7 +195,7 @@ trait AsyncTests[F[_]] extends GenTemporalTests[F, Throwable] with SyncTests[F] new RuleSet { val name = "async" - val bases = Nil + val bases: Seq[(String, Laws#RuleSet)] = Nil val parents = Seq( temporal[A, B, C](tolerance)( implicitly[Arbitrary[A]], diff --git a/laws/shared/src/main/scala/cats/effect/laws/ClockTests.scala b/laws/shared/src/main/scala/cats/effect/laws/ClockTests.scala index c58871f53e..dc5178c8ba 100644 --- a/laws/shared/src/main/scala/cats/effect/laws/ClockTests.scala +++ b/laws/shared/src/main/scala/cats/effect/laws/ClockTests.scala @@ -29,8 +29,8 @@ trait ClockTests[F[_]] extends Laws { def clock(implicit exec: F[Boolean] => Prop): RuleSet = { new RuleSet { val name = "clock" - val bases = Nil - val parents = Seq() + val bases: Seq[(String, Laws#RuleSet)] = Nil + val parents: Seq[RuleSet] = Seq() val props = Seq("monotonicity" -> exec(laws.monotonicity)) } diff --git a/laws/shared/src/main/scala/cats/effect/laws/GenSpawnTests.scala b/laws/shared/src/main/scala/cats/effect/laws/GenSpawnTests.scala index 44aac420e6..8ab1a64495 100644 --- a/laws/shared/src/main/scala/cats/effect/laws/GenSpawnTests.scala +++ b/laws/shared/src/main/scala/cats/effect/laws/GenSpawnTests.scala @@ -24,6 +24,7 @@ import cats.laws.discipline.SemigroupalTests.Isomorphisms import org.scalacheck._ import org.scalacheck.Prop.forAll import org.scalacheck.util.Pretty +import org.typelevel.discipline.Laws trait GenSpawnTests[F[_], E] extends MonadCancelTests[F, E] with UniqueTests[F] { @@ -68,7 +69,7 @@ trait GenSpawnTests[F[_], E] extends MonadCancelTests[F, E] with UniqueTests[F] // these are the OLD LAWS retained only for bincompat new RuleSet { val name = "concurrent" - val bases = Nil + val bases: Seq[(String, Laws#RuleSet)] = Nil val parents = Seq( monadCancel[A, B, C]( implicitly[Arbitrary[A]], @@ -159,7 +160,7 @@ trait GenSpawnTests[F[_], E] extends MonadCancelTests[F, E] with UniqueTests[F] new RuleSet { val name = "concurrent" - val bases = Nil + val bases: Seq[(String, Laws#RuleSet)] = Nil val parents = Seq( monadCancel[A, B, C]( implicitly[Arbitrary[A]], diff --git a/laws/shared/src/main/scala/cats/effect/laws/GenTemporalTests.scala b/laws/shared/src/main/scala/cats/effect/laws/GenTemporalTests.scala index 83127ae52e..c63579943c 100644 --- a/laws/shared/src/main/scala/cats/effect/laws/GenTemporalTests.scala +++ b/laws/shared/src/main/scala/cats/effect/laws/GenTemporalTests.scala @@ -24,6 +24,7 @@ import cats.laws.discipline.SemigroupalTests.Isomorphisms import org.scalacheck._ import org.scalacheck.Prop.forAll import org.scalacheck.util.Pretty +import org.typelevel.discipline.Laws import scala.concurrent.duration.FiniteDuration @@ -84,7 +85,7 @@ trait GenTemporalTests[F[_], E] extends GenSpawnTests[F, E] with ClockTests[F] { new RuleSet { val name = "temporal" - val bases = Nil + val bases: Seq[(String, Laws#RuleSet)] = Nil val parents = Seq( spawn[A, B, C]( implicitly[Arbitrary[A]], @@ -177,7 +178,7 @@ trait GenTemporalTests[F[_], E] extends GenSpawnTests[F, E] with ClockTests[F] { new RuleSet { val name = "temporal" - val bases = Nil + val bases: Seq[(String, Laws#RuleSet)] = Nil val parents = Seq( spawn[A, B, C]( implicitly[Arbitrary[A]], diff --git a/laws/shared/src/main/scala/cats/effect/laws/MonadCancelTests.scala b/laws/shared/src/main/scala/cats/effect/laws/MonadCancelTests.scala index 870815de69..f91ebfa3d5 100644 --- a/laws/shared/src/main/scala/cats/effect/laws/MonadCancelTests.scala +++ b/laws/shared/src/main/scala/cats/effect/laws/MonadCancelTests.scala @@ -25,6 +25,7 @@ import cats.laws.discipline.SemigroupalTests.Isomorphisms import org.scalacheck._ import org.scalacheck.Prop.forAll import org.scalacheck.util.Pretty +import org.typelevel.discipline.Laws trait MonadCancelTests[F[_], E] extends MonadErrorTests[F, E] { @@ -111,7 +112,7 @@ trait MonadCancelTests[F[_], E] extends MonadErrorTests[F, E] { new RuleSet { val name = "monadCancel" - val bases = Nil + val bases: Seq[(String, Laws#RuleSet)] = Nil val parents = Seq(monadError[A, B, C]) val props = { diff --git a/laws/shared/src/main/scala/cats/effect/laws/SyncTests.scala b/laws/shared/src/main/scala/cats/effect/laws/SyncTests.scala index 78af874d09..269a40a995 100644 --- a/laws/shared/src/main/scala/cats/effect/laws/SyncTests.scala +++ b/laws/shared/src/main/scala/cats/effect/laws/SyncTests.scala @@ -23,6 +23,7 @@ import cats.laws.discipline.SemigroupalTests.Isomorphisms import org.scalacheck._ import org.scalacheck.Prop.forAll +import org.typelevel.discipline.Laws trait SyncTests[F[_]] extends MonadCancelTests[F, Throwable] @@ -58,7 +59,7 @@ trait SyncTests[F[_]] new RuleSet { val name = "sync" - val bases = Nil + val bases: Seq[(String, Laws#RuleSet)] = Nil val parents = Seq( monadCancel[A, B, C]( implicitly[Arbitrary[A]], diff --git a/laws/shared/src/main/scala/cats/effect/laws/UniqueTests.scala b/laws/shared/src/main/scala/cats/effect/laws/UniqueTests.scala index 32f111a1fa..f44b470ef6 100644 --- a/laws/shared/src/main/scala/cats/effect/laws/UniqueTests.scala +++ b/laws/shared/src/main/scala/cats/effect/laws/UniqueTests.scala @@ -29,8 +29,8 @@ trait UniqueTests[F[_]] extends Laws { def unique(implicit exec: F[Boolean] => Prop): RuleSet = { new RuleSet { val name = "unique" - val bases = Nil - val parents = Seq() + val bases: Seq[(String, Laws#RuleSet)] = Nil + val parents: Seq[RuleSet] = Seq() val props = Seq("uniqueness" -> exec(laws.uniqueness)) } diff --git a/tests/jvm/src/test/scala/cats/effect/IOPlatformSpecification.scala b/tests/jvm/src/test/scala/cats/effect/IOPlatformSpecification.scala index 5d095460b6..9e69674c6f 100644 --- a/tests/jvm/src/test/scala/cats/effect/IOPlatformSpecification.scala +++ b/tests/jvm/src/test/scala/cats/effect/IOPlatformSpecification.scala @@ -501,7 +501,7 @@ trait IOPlatformSpecification { self: BaseSpec with ScalaCheck => } } - def makeApi(register: (Poller => Unit) => Unit) = + def makeApi(register: (Poller => Unit) => Unit): DummySystem.Api = new DummyPoller { def poll = IO.async_[Unit] { cb => register { poller => diff --git a/tests/jvm/src/test/scala/cats/effect/std/DeferredJVMSpec.scala b/tests/jvm/src/test/scala/cats/effect/std/DeferredJVMSpec.scala index 9aa628f984..6d045b6822 100644 --- a/tests/jvm/src/test/scala/cats/effect/std/DeferredJVMSpec.scala +++ b/tests/jvm/src/test/scala/cats/effect/std/DeferredJVMSpec.scala @@ -47,7 +47,7 @@ abstract class BaseDeferredJVMTests(parallelism: Int) implicit val runtime: IORuntime = IORuntime.global - def before = + def before: Any = service = Executors.newFixedThreadPool( parallelism, new ThreadFactory { @@ -61,7 +61,7 @@ abstract class BaseDeferredJVMTests(parallelism: Int) } ) - def after = { + def after: Any = { service.shutdown() assert(service.awaitTermination(60, TimeUnit.SECONDS), "has active threads") } diff --git a/tests/shared/src/test/scala/cats/effect/IOSpec.scala b/tests/shared/src/test/scala/cats/effect/IOSpec.scala index d8152ccc81..34134247a0 100644 --- a/tests/shared/src/test/scala/cats/effect/IOSpec.scala +++ b/tests/shared/src/test/scala/cats/effect/IOSpec.scala @@ -24,6 +24,7 @@ import cats.kernel.laws.discipline.MonoidTests import cats.laws.discipline.{AlignTests, SemigroupKTests} import cats.laws.discipline.arbitrary._ import cats.syntax.all._ +import cats.~> import org.scalacheck.Prop import org.typelevel.discipline.specs2.mutable.Discipline @@ -1325,8 +1326,9 @@ class IOSpec extends BaseSpec with Discipline with IOPlatformSpecification { "catch exceptions in cont" in ticked { implicit ticker => IO.cont[Unit, Unit](new Cont[IO, Unit, Unit] { - override def apply[F[_]](implicit F: MonadCancel[F, Throwable]) = { (_, _, _) => - throw new Exception + override def apply[F[_]](implicit F: MonadCancel[F, Throwable]) + : (Either[Throwable, Unit] => Unit, F[Unit], cats.effect.IO ~> F) => F[Unit] = { + (_, _, _) => throw new Exception } }).voidError must completeAs(()) } From 560deb0c726f781626794d130c27d232c569242a Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 10 Sep 2023 19:23:24 +0000 Subject: [PATCH 2/2] Remove unneeded overrides --- .../shared/src/main/scala/cats/effect/kernel/Resource.scala | 5 ----- 1 file changed, 5 deletions(-) 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 b93f73cce5..6169d4ee3a 100644 --- a/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala +++ b/kernel/shared/src/main/scala/cats/effect/kernel/Resource.scala @@ -1223,7 +1223,6 @@ private[effect] trait ResourceHOInstances0 extends ResourceHOInstances1 { implicit def catsEffectAsyncForResource[F[_]](implicit F0: Async[F]): Async[Resource[F, *]] = new ResourceAsync[F] { def F = F0 - override def applicative: ResourceAsync[F] = this } implicit def catsEffectSemigroupKForResource[F[_], A]( @@ -1242,7 +1241,6 @@ private[effect] trait ResourceHOInstances1 extends ResourceHOInstances2 { implicit F0: Temporal[F]): Temporal[Resource[F, *]] = new ResourceTemporal[F] { def F = F0 - override def applicative: Applicative[Resource[F, *]] = this } implicit def catsEffectSyncForResource[F[_]](implicit F0: Sync[F]): Sync[Resource[F, *]] = @@ -1257,7 +1255,6 @@ private[effect] trait ResourceHOInstances2 extends ResourceHOInstances3 { implicit F0: Concurrent[F]): Concurrent[Resource[F, *]] = new ResourceConcurrent[F] { def F = F0 - override def applicative: ResourceConcurrent[F] = this } implicit def catsEffectClockForResource[F[_]]( @@ -1430,8 +1427,6 @@ abstract private[effect] class ResourceAsync[F[_]] with Async[Resource[F, *]] { self => implicit protected def F: Async[F] - override def applicative: ResourceAsync[F] = this - override def unique: Resource[F, Unique.Token] = Resource.unique