Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workaround for Scala3 in Supervisor #3650

Merged
merged 3 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 52 additions & 42 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -907,48 +907,58 @@ lazy val std = crossProject(JSPlatform, JVMPlatform, NativePlatform)
"org.scalacheck" %%% "scalacheck" % ScalaCheckVersion % Test,
"org.specs2" %%% "specs2-scalacheck" % Specs2Version % Test
),
mimaBinaryIssueFilters ++= Seq(
// introduced by #2604, Fix Console on JS
// changes to `cats.effect.std` package private code
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.Console$SyncConsole"),
// introduced by #2951
// added configurability to Supervisor's scope termination behavior
// the following are package-private APIs
ProblemFilters.exclude[IncompatibleMethTypeProblem](
"cats.effect.std.Supervisor#State.add"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"cats.effect.std.Supervisor#State.add"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"cats.effect.std.Supervisor#State.joinAll"),
// introduced by #3000
// package-private or private stuff
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.Queue#AbstractQueue.onOfferNoCapacity"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"cats.effect.std.Queue#AbstractQueue.onOfferNoCapacity"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.Queue#BoundedQueue.onOfferNoCapacity"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.Queue#CircularBufferQueue.onOfferNoCapacity"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.Queue#DroppingQueue.onOfferNoCapacity"),
// #3524, private class
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.MapRef#ConcurrentHashMapImpl.keys"),
// introduced by #3346
// private stuff
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.Mutex$Impl"),
// introduced by #3347
// private stuff
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.AtomicCell$Impl"),
// introduced by #3409
// extracted UnsafeUnbounded private data structure
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.Queue$UnsafeUnbounded"),
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.Queue$UnsafeUnbounded$Cell"),
// introduced by #3480
// adds method to sealed Hotswap
ProblemFilters.exclude[ReversedMissingMethodProblem]("cats.effect.std.Hotswap.get")
)
mimaBinaryIssueFilters ++= {
if (tlIsScala3.value) {
Seq(
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.Supervisor.apply$default$2")
)
} else Seq()
},
mimaBinaryIssueFilters ++=
Seq(
// introduced by #2604, Fix Console on JS
// changes to `cats.effect.std` package private code
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.Console$SyncConsole"),
// introduced by #2951
// added configurability to Supervisor's scope termination behavior
// the following are package-private APIs
ProblemFilters.exclude[IncompatibleMethTypeProblem](
"cats.effect.std.Supervisor#State.add"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"cats.effect.std.Supervisor#State.add"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"cats.effect.std.Supervisor#State.joinAll"),
// introduced by #3000
// package-private or private stuff
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.Queue#AbstractQueue.onOfferNoCapacity"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"cats.effect.std.Queue#AbstractQueue.onOfferNoCapacity"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.Queue#BoundedQueue.onOfferNoCapacity"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.Queue#CircularBufferQueue.onOfferNoCapacity"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.Queue#DroppingQueue.onOfferNoCapacity"),
// #3524, private class
ProblemFilters.exclude[DirectMissingMethodProblem](
"cats.effect.std.MapRef#ConcurrentHashMapImpl.keys"),
// introduced by #3346
// private stuff
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.Mutex$Impl"),
// introduced by #3347
// private stuff
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.AtomicCell$Impl"),
// introduced by #3409
// extracted UnsafeUnbounded private data structure
ProblemFilters.exclude[MissingClassProblem]("cats.effect.std.Queue$UnsafeUnbounded"),
ProblemFilters.exclude[MissingClassProblem](
"cats.effect.std.Queue$UnsafeUnbounded$Cell"),
// introduced by #3480
// adds method to sealed Hotswap
ProblemFilters.exclude[ReversedMissingMethodProblem]("cats.effect.std.Hotswap.get")
)
)
.jsSettings(
libraryDependencies += "org.scala-js" %%% "scala-js-macrotask-executor" % MacrotaskExecutorVersion % Test,
Expand Down
3 changes: 1 addition & 2 deletions std/shared/src/main/scala/cats/effect/std/Dispatcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ object Dispatcher {
val (workers, makeFork) =
mode match {
case Mode.Parallel =>
// TODO we have to do this for now because Scala 3 doesn't like it (lampepfl/dotty#15546)
(Cpus, Supervisor[F](await, None).map(s => s.supervise(_: F[Unit]).map(_.cancel)))
(Cpus, Supervisor[F](await).map(s => s.supervise(_: F[Unit]).map(_.cancel)))

case Mode.Sequential =>
(
Expand Down
7 changes: 2 additions & 5 deletions std/shared/src/main/scala/cats/effect/std/Supervisor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ object Supervisor {

private[std] def apply[F[_]](
await: Boolean,
checkRestart: Option[Outcome[F, Throwable, _] => Boolean] = None)(
checkRestart: Option[Outcome[F, Throwable, _] => Boolean])(
implicit F: Concurrent[F]): Resource[F, Supervisor[F]] = {
F match {
case asyncF: Async[F] => applyForAsync(await, checkRestart)(asyncF)
Expand All @@ -136,10 +136,7 @@ object Supervisor {
}

def apply[F[_]: Concurrent]: Resource[F, Supervisor[F]] =
apply[F](
false,
None
) // TODO we have to do this for now because Scala 3 doesn't like it (lampepfl/dotty#15546)
apply[F](false)

private trait State[F[_]] {
def remove(token: Unique.Token): F[Unit]
Expand Down