diff --git a/binCompatTest/src/main/scala/catsBC/MimaExceptions.scala b/binCompatTest/src/main/scala/catsBC/MimaExceptions.scala index 3d955ebe50..e3fcf47d22 100644 --- a/binCompatTest/src/main/scala/catsBC/MimaExceptions.scala +++ b/binCompatTest/src/main/scala/catsBC/MimaExceptions.scala @@ -8,22 +8,24 @@ object MimaExceptions { import cats.arrow.FunctionK // needs to be imported because of a hygiene problem def isBinaryCompatible = ( - cats.Monad[cats.data.OptionT[List, ?]], - cats.data.OptionT.catsDataTraverseForOptionT[List], - cats.data.Kleisli.catsDataCommutativeArrowForKleisliId, - cats.data.OptionT.catsDataMonoidKForOptionT[List], - cats.data.OptionT.catsDataMonoidForOptionT[List, Int], - cats.data.Kleisli.catsDataMonadForKleisliId[Int], - cats.data.Kleisli.catsDataCommutativeArrowForKleisli[Option], - cats.data.Kleisli.catsDataCommutativeFlatMapForKleisli[Option, Int], - cats.data.IRWST.catsDataStrongForIRWST[List, Int, Int, Int], - cats.data.OptionT.catsDataMonadErrorMonadForOptionT[List], - FunctionK.lift(headOption), - cats.data.OptionT.catsDataMonadErrorForOptionT[Either[String, ?], String], - cats.data.OptionT[Either[String, ?], Int](Right(Some(17))).ensure("error")(_ => true), - "blah".leftNec[Int], - List(Some(4), None).nested, - cats.data.EitherT.left[Int](Option("err")), - true.iterateUntilM(Option(_))(identity _) + cats.Monad[cats.data.OptionT[List, ?]], + cats.data.OptionT.catsDataTraverseForOptionT[List], + cats.data.Kleisli.catsDataCommutativeArrowForKleisliId, + cats.data.OptionT.catsDataMonoidKForOptionT[List], + cats.data.OptionT.catsDataMonoidForOptionT[List, Int], + cats.data.Kleisli.catsDataMonadForKleisliId[Int], + cats.data.Kleisli.catsDataCommutativeArrowForKleisli[Option], + cats.data.Kleisli.catsDataCommutativeFlatMapForKleisli[Option, Int], + cats.data.IRWST.catsDataStrongForIRWST[List, Int, Int, Int], + cats.data.OptionT.catsDataMonadErrorMonadForOptionT[List], + FunctionK.lift(headOption), + cats.data.OptionT.catsDataMonadErrorForOptionT[Either[String, ?], String], + cats.data.OptionT[Either[String, ?], Int](Right(Some(17))).ensure("error")(_ => true), + "blah".leftNec[Int], + List(Some(4), None).nested, + cats.data.EitherT.left[Int](Option("err")), + true.iterateUntilM(Option(_))(identity _), + Either.catchOnly[NumberFormatException] { "foo".toInt }, + (1.validNel[String], 2.validNel[String], 3.validNel[String]) mapN (_ + _ + _) ) } diff --git a/build.sbt b/build.sbt index 2f8c58a968..ef8f81d674 100644 --- a/build.sbt +++ b/build.sbt @@ -321,6 +321,7 @@ def mimaSettings(moduleName: String) = exclude[DirectMissingMethodProblem]("cats.syntax.DistributiveOps.fa"), exclude[DirectMissingMethodProblem]("cats.syntax.EitherIdOps.obj"), exclude[DirectMissingMethodProblem]("cats.syntax.EitherIdOpsBinCompat0.value"), + exclude[DirectMissingMethodProblem]("cats.syntax.EitherSyntax#CatchOnlyPartiallyApplied.dummy"), exclude[DirectMissingMethodProblem]("cats.syntax.EitherKOps.fa"), exclude[DirectMissingMethodProblem]("cats.syntax.EitherObjectOps.either"), exclude[DirectMissingMethodProblem]("cats.syntax.EitherOps.eab"), @@ -372,10 +373,26 @@ def mimaSettings(moduleName: String) = exclude[MissingTypesProblem]("cats.arrow.FunctionKMacros$"), exclude[IncompatibleMethTypeProblem]("cats.arrow.FunctionKMacros#Lifter.this"), exclude[IncompatibleResultTypeProblem]("cats.arrow.FunctionKMacros#Lifter.c") - ) + ) ++ mimaBoilerplateSyntaxExclusions(scalaVersion.value) } ) +def mimaBoilerplateSyntaxExclusions(scalaVersion: String) = { + import com.typesafe.tools.mima.core._ + import com.typesafe.tools.mima.core.ProblemFilters._ + + Seq( + exclude[IncompatibleResultTypeProblem]("cats.*.catsSyntaxTuple*Parallel") + ) ++ (CrossVersion.partialVersion(scalaVersion) match { + case Some((2, 11)) => + Seq( + exclude[DirectMissingMethodProblem]("cats.syntax.TupleParallelSyntax.catsSyntaxTuple*Parallel"), + exclude[ReversedMissingMethodProblem]("cats.syntax.TupleParallelSyntax.catsSyntaxTuple*Parallel") + ) + case _ => Seq.empty + }) +} + lazy val docs = project .enablePlugins(MicrositesPlugin) .enablePlugins(ScalaUnidocPlugin) diff --git a/core/src/main/scala/cats/syntax/either.scala b/core/src/main/scala/cats/syntax/either.scala index 9b4c92f834..deb606aac2 100644 --- a/core/src/main/scala/cats/syntax/either.scala +++ b/core/src/main/scala/cats/syntax/either.scala @@ -25,7 +25,7 @@ object EitherSyntax { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[syntax] class CatchOnlyPartiallyApplied[T](val dummy: Boolean = true) extends AnyVal { + final private[syntax] class CatchOnlyPartiallyApplied[T](private val dummy: Boolean = true) extends AnyVal { def apply[A](f: => A)(implicit CT: ClassTag[T], NT: NotNull[T]): Either[T, A] = try { Right(f) diff --git a/core/src/main/scala/cats/syntax/foldable.scala b/core/src/main/scala/cats/syntax/foldable.scala index 93e130d142..2e3771b958 100644 --- a/core/src/main/scala/cats/syntax/foldable.scala +++ b/core/src/main/scala/cats/syntax/foldable.scala @@ -198,7 +198,7 @@ final class FoldableOps[F[_], A](private val fa: F[A]) extends AnyVal { } -final class FoldableOps0[F[_], A](val fa: F[A]) extends AnyVal { +final class FoldableOps0[F[_], A](private val fa: F[A]) extends AnyVal { /** * Fold implemented by mapping `A` values into `B` in a context `G` and then diff --git a/core/src/main/scala/cats/syntax/reducible.scala b/core/src/main/scala/cats/syntax/reducible.scala index 2fe183ad64..eeb17bc39d 100644 --- a/core/src/main/scala/cats/syntax/reducible.scala +++ b/core/src/main/scala/cats/syntax/reducible.scala @@ -15,7 +15,7 @@ trait ReducibleSyntaxBinCompat0 { new ReducibleOps0[F, A](fa) } -final class ReducibleOps0[F[_], A](val fa: F[A]) extends AnyVal { +final class ReducibleOps0[F[_], A](private val fa: F[A]) extends AnyVal { /** * Apply `f` to each element of `fa` and combine them using the diff --git a/core/src/main/scala/cats/syntax/traverseFilter.scala b/core/src/main/scala/cats/syntax/traverseFilter.scala index 1763731702..29daa9eb56 100644 --- a/core/src/main/scala/cats/syntax/traverseFilter.scala +++ b/core/src/main/scala/cats/syntax/traverseFilter.scala @@ -8,7 +8,7 @@ trait TraverseFilterSyntaxBinCompat0 { new SequenceFilterOps(fgoa) } -final class SequenceFilterOps[F[_], G[_], A](val fgoa: F[G[Option[A]]]) extends AnyVal { +final class SequenceFilterOps[F[_], G[_], A](private val fgoa: F[G[Option[A]]]) extends AnyVal { /** * {{{ diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/package.scala b/kernel-laws/src/main/scala/cats/kernel/laws/package.scala index 47a8f44621..6b2e9613ca 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/package.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/package.scala @@ -2,7 +2,7 @@ package cats.kernel package object laws { - implicit final class IsEqArrow[A](val lhs: A) extends AnyVal { + implicit final class IsEqArrow[A](private val lhs: A) extends AnyVal { def <->(rhs: A): IsEq[A] = IsEq(lhs, rhs) } } diff --git a/laws/src/main/scala/cats/laws/package.scala b/laws/src/main/scala/cats/laws/package.scala index 3b3a5d13d3..aafeffb16e 100644 --- a/laws/src/main/scala/cats/laws/package.scala +++ b/laws/src/main/scala/cats/laws/package.scala @@ -5,7 +5,7 @@ package object laws { type IsEq[A] = cats.kernel.laws.IsEq[A] val IsEq = cats.kernel.laws.IsEq - implicit final class IsEqArrow[A](val lhs: A) extends AnyVal { + implicit final class IsEqArrow[A](private val lhs: A) extends AnyVal { def <->(rhs: A): IsEq[A] = IsEq(lhs, rhs) } } diff --git a/project/Boilerplate.scala b/project/Boilerplate.scala index 8812df4165..6719445081 100644 --- a/project/Boilerplate.scala +++ b/project/Boilerplate.scala @@ -12,7 +12,7 @@ import sbt._ object Boilerplate { import scala.StringContext._ - implicit final class BlockHelper(val sc: StringContext) extends AnyVal { + implicit final class BlockHelper(private val sc: StringContext) extends AnyVal { def block(args: Any*): String = { val interpolated = sc.standardInterpolator(treatEscapes, args) val rawLines = interpolated.split('\n') @@ -404,7 +404,7 @@ object Boilerplate { - implicit def catsSyntaxTuple${arity}Parallel[M[_], ${`A..N`}]($tupleTpe): Tuple${arity}ParallelOps[M, ${`A..N`}] = new Tuple${arity}ParallelOps(t$arity) |} | - -private[syntax] final class Tuple${arity}ParallelOps[M[_], ${`A..N`}]($tupleTpe) { + -private[syntax] final class Tuple${arity}ParallelOps[M[_], ${`A..N`}](private val $tupleTpe) extends AnyVal { - $parMap - $parTupled -} diff --git a/project/KernelBoiler.scala b/project/KernelBoiler.scala index 95efe25eb5..4b35dcecb3 100644 --- a/project/KernelBoiler.scala +++ b/project/KernelBoiler.scala @@ -13,7 +13,7 @@ import sbt._ object KernelBoiler { import scala.StringContext._ - implicit class BlockHelper(val sc: StringContext) extends AnyVal { + implicit class BlockHelper(private val sc: StringContext) extends AnyVal { def block(args: Any*): String = { val interpolated = sc.standardInterpolator(treatEscapes, args) val rawLines = interpolated.split('\n')