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

Private val in value classes (Resolve TODO since 2.10 is dropped) #2692

Merged
merged 6 commits into from
Jan 17, 2019
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
36 changes: 19 additions & 17 deletions binCompatTest/src/main/scala/catsBC/MimaExceptions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 (_ + _ + _)
)
}
19 changes: 18 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/syntax/either.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/syntax/foldable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/syntax/reducible.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/syntax/traverseFilter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

/**
* {{{
Expand Down
2 changes: 1 addition & 1 deletion kernel-laws/src/main/scala/cats/kernel/laws/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion laws/src/main/scala/cats/laws/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
4 changes: 2 additions & 2 deletions project/Boilerplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
-}
Expand Down
2 changes: 1 addition & 1 deletion project/KernelBoiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down