From 36e7c5bdfca132bf76f033827efbce91a290c326 Mon Sep 17 00:00:00 2001 From: satorg Date: Mon, 18 Apr 2022 00:41:44 -0700 Subject: [PATCH] in coreJVM --- .../src/main/scala/cats/compat/targetName.scala | 5 +++-- core/src/main/scala/cats/ApplicativeError.scala | 9 ++------- core/src/main/scala/cats/data/Const.scala | 4 ++-- .../scala/cats/data/IndexedReaderWriterStateT.scala | 2 +- core/src/main/scala/cats/data/Validated.scala | 8 ++------ core/src/main/scala/cats/syntax/applicativeError.scala | 5 ++--- core/src/main/scala/cats/syntax/either.scala | 10 +++------- 7 files changed, 15 insertions(+), 28 deletions(-) diff --git a/core/src/main/scala-2/src/main/scala/cats/compat/targetName.scala b/core/src/main/scala-2/src/main/scala/cats/compat/targetName.scala index 50ef43c259..727b6279da 100644 --- a/core/src/main/scala-2/src/main/scala/cats/compat/targetName.scala +++ b/core/src/main/scala-2/src/main/scala/cats/compat/targetName.scala @@ -21,8 +21,9 @@ package cats.compat +import cats.kernel.compat.unused + import scala.annotation.Annotation -import scala.annotation.nowarn // compat dummy so we can use targetName on scala 3 to get out of bincompat pickles -private[cats] class targetName(@nowarn("cat=unused-params") dummy: String) extends Annotation +private[cats] class targetName(@unused dummy: String) extends Annotation diff --git a/core/src/main/scala/cats/ApplicativeError.scala b/core/src/main/scala/cats/ApplicativeError.scala index 4c7eb925cb..51374d9a42 100644 --- a/core/src/main/scala/cats/ApplicativeError.scala +++ b/core/src/main/scala/cats/ApplicativeError.scala @@ -24,8 +24,8 @@ package cats import cats.ApplicativeError.CatchOnlyPartiallyApplied import cats.data.{EitherT, Validated} import cats.data.Validated.{Invalid, Valid} +import cats.kernel.compat.unused -import scala.annotation.nowarn import scala.reflect.ClassTag import scala.util.control.NonFatal import scala.util.{Failure, Success, Try} @@ -355,12 +355,7 @@ object ApplicativeError { final private[cats] class CatchOnlyPartiallyApplied[T, F[_], E](private val F: ApplicativeError[F, E]) extends AnyVal { - def apply[A](f: => A)(implicit - CT: ClassTag[T], - @nowarn("cat=unused-params") - NT: NotNull[T], - ev: Throwable <:< E - ): F[A] = + def apply[A](f: => A)(implicit CT: ClassTag[T], @unused NT: NotNull[T], ev: Throwable <:< E): F[A] = try { F.pure(f) } catch { diff --git a/core/src/main/scala/cats/data/Const.scala b/core/src/main/scala/cats/data/Const.scala index d6722f0691..271bd573b1 100644 --- a/core/src/main/scala/cats/data/Const.scala +++ b/core/src/main/scala/cats/data/Const.scala @@ -23,7 +23,7 @@ package cats package data import cats.kernel.{CommutativeMonoid, CommutativeSemigroup, LowerBounded, UpperBounded} -import scala.annotation.nowarn +import cats.kernel.compat.unused /** * [[Const]] is a phantom type, it does not contain a value of its second type parameter `B` @@ -40,7 +40,7 @@ final case class Const[A, B](getConst: A) { def combine(that: Const[A, B])(implicit A: Semigroup[A]): Const[A, B] = Const(A.combine(getConst, that.getConst)) - def traverse[F[_], C](@nowarn("cat=unused-params") f: B => F[C])(implicit F: Applicative[F]): F[Const[A, C]] = + def traverse[F[_], C](@unused f: B => F[C])(implicit F: Applicative[F]): F[Const[A, C]] = F.pure(retag[C]) def ===(that: Const[A, B])(implicit A: Eq[A]): Boolean = diff --git a/core/src/main/scala/cats/data/IndexedReaderWriterStateT.scala b/core/src/main/scala/cats/data/IndexedReaderWriterStateT.scala index de542ff40a..02c7f7ce48 100644 --- a/core/src/main/scala/cats/data/IndexedReaderWriterStateT.scala +++ b/core/src/main/scala/cats/data/IndexedReaderWriterStateT.scala @@ -558,7 +558,7 @@ abstract private[data] class RWSFunctions { def apply[E, L, S, A](f: (E, S) => (L, S, A)): ReaderWriterState[E, L, S, A] = ReaderWriterStateT.applyF(Now((e, s) => Now(f(e, s)))) - @deprecated("2.8.0", "Use apply without the Monoid constraint") + @deprecated("Use apply without the Monoid constraint", "2.8.0") protected def apply[E, L: Monoid, S, A](f: (E, S) => (L, S, A)): ReaderWriterState[E, L, S, A] = ReaderWriterStateT.applyF(Now((e, s) => Now(f(e, s)))) diff --git a/core/src/main/scala/cats/data/Validated.scala b/core/src/main/scala/cats/data/Validated.scala index ce3311dc58..902be5139a 100644 --- a/core/src/main/scala/cats/data/Validated.scala +++ b/core/src/main/scala/cats/data/Validated.scala @@ -24,8 +24,8 @@ package data import cats.data.Validated.{Invalid, Valid} import cats.kernel.CommutativeSemigroup +import cats.kernel.compat.unused -import scala.annotation.nowarn import scala.reflect.ClassTag import scala.util.{Failure, Success, Try} @@ -860,11 +860,7 @@ object Validated extends ValidatedInstances with ValidatedFunctions with Validat final private[data] class CatchOnlyPartiallyApplied[T](private val dummy: Boolean = true) extends AnyVal { /* Note: the NT parameter is not referenced at runtime, but serves a compile-time role. * See https://github.com/typelevel/cats/pull/1867/files#r138381991 for details. */ - def apply[A](f: => A)(implicit - T: ClassTag[T], - @nowarn("cat=unused-params") - NT: NotNull[T] - ): Validated[T, A] = + def apply[A](f: => A)(implicit T: ClassTag[T], @unused NT: NotNull[T]): Validated[T, A] = try { valid(f) } catch { diff --git a/core/src/main/scala/cats/syntax/applicativeError.scala b/core/src/main/scala/cats/syntax/applicativeError.scala index e81baaeeca..fbf451a4e8 100644 --- a/core/src/main/scala/cats/syntax/applicativeError.scala +++ b/core/src/main/scala/cats/syntax/applicativeError.scala @@ -23,8 +23,8 @@ package cats package syntax import cats.data.{EitherT, Validated} +import cats.kernel.compat.unused -import scala.annotation.nowarn import scala.reflect.ClassTag trait ApplicativeErrorSyntax { @@ -33,8 +33,7 @@ trait ApplicativeErrorSyntax { implicit final def catsSyntaxApplicativeError[F[_], E, A](fa: F[A])(implicit // Although not used directly but helps the compiler to deduce type `E`. - @nowarn("cat=unused-params") - F: ApplicativeError[F, E] + @unused F: ApplicativeError[F, E] ): ApplicativeErrorOps[F, E, A] = new ApplicativeErrorOps[F, E, A](fa) } diff --git a/core/src/main/scala/cats/syntax/either.scala b/core/src/main/scala/cats/syntax/either.scala index 220c0ce298..128f2f5ae2 100644 --- a/core/src/main/scala/cats/syntax/either.scala +++ b/core/src/main/scala/cats/syntax/either.scala @@ -23,8 +23,8 @@ package cats package syntax import cats.data._ +import cats.kernel.compat.unused -import scala.annotation.nowarn import scala.reflect.ClassTag import scala.util.{Failure, Success, Try} import EitherSyntax._ @@ -48,11 +48,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](private val dummy: Boolean = true) extends AnyVal { - def apply[A](f: => A)(implicit - CT: ClassTag[T], - @nowarn("cat=unused-params") - NT: NotNull[T] - ): Either[T, A] = + def apply[A](f: => A)(implicit CT: ClassTag[T], @unused NT: NotNull[T]): Either[T, A] = try { Right(f) } catch { @@ -371,7 +367,7 @@ final class EitherObjectOps(private val either: Either.type) extends AnyVal with def leftNes[A, B](a: A)(implicit O: Order[A]): EitherNes[A, B] = Left(NonEmptySet.one(a)) - @deprecated("2.8.0", "Use rightNes without Order constraint") + @deprecated("Use rightNes without Order constraint", "2.8.0") protected def rightNes[A, B](b: B)(implicit O: Order[B]): EitherNes[A, B] = Right(b) def leftNel[A, B](a: A): EitherNel[A, B] = Left(NonEmptyList.one(a))