Skip to content

Commit

Permalink
in coreJVM
Browse files Browse the repository at this point in the history
  • Loading branch information
satorg committed Jun 9, 2022
1 parent a21fdec commit 9adfe9f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 2 additions & 7 deletions core/src/main/scala/cats/ApplicativeError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/data/Const.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))))

Expand Down
8 changes: 2 additions & 6 deletions core/src/main/scala/cats/data/Validated.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down Expand Up @@ -869,11 +869,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 {
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/scala/cats/syntax/applicativeError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand Down
10 changes: 3 additions & 7 deletions core/src/main/scala/cats/syntax/either.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand All @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 9adfe9f

Please sign in to comment.