Skip to content

Commit

Permalink
Fixed warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Grryum committed Nov 22, 2023
1 parent ea26dbe commit 77424f2
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 22 deletions.
14 changes: 9 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ lazy val defaultSettings = Seq(
setMinorVersion,
scalacWarningConfig,
Test / tpolecatExcludeOptions += ScalacOptions.warnNonUnitStatement,
Compile / doc / tpolecatExcludeOptions += ScalacOptions.fatalWarnings,
Compile / doc / tpolecatExcludeOptions ++= Set(ScalacOptions.fatalWarnings, ScalacOptions.warnError),
//docs / scalacOptions -= "-Xfatal-warnings",
crossScalaVersions := Vector(Version.scala212, Version.scala213),
libraryDependencies ++= {
(CrossVersion.partialVersion(scalaVersion.value) match {
Expand Down Expand Up @@ -492,17 +493,20 @@ lazy val scalacWarningConfig = tpolecatScalacOptions ++= {
// }.mkString(",")

// print warning category for fine-grained suppressing, e.g. @nowarn("cat=unused-params")
val contextDeprecationInfo = "cat=deprecation&msg=^(.*((Has)|(With)|(Logging)).*)$:silent"
val contextDeprecationInfo = "cat=deprecation&msg=^(.*((Has)|(With)|(Logging)|(Mut)).*)$:silent"
val concurrentDeprecationInfo = "cat=deprecation&msg=^(.*((Mut)|(MVar)).*)$:silent"
val deprecationInfo = s"$contextDeprecationInfo,$concurrentDeprecationInfo"

val verboseWarnings = "any:wv"
val scala3MigrationWarnings = "cat=scala3-migration:silent"

Set(
ScalacOption(s"-Wconf:$contextDeprecationInfo", _ >= ScalaVersion.V3_0_0),
ScalacOption(s"-Wconf:$deprecationInfo", _ >= ScalaVersion.V3_0_0),
ScalacOption(
s"-Wconf:$contextDeprecationInfo,$scala3MigrationWarnings,$verboseWarnings",
s"-Wconf:$deprecationInfo,$scala3MigrationWarnings,$verboseWarnings",
_.isBetween(ScalaVersion.V2_13_0, ScalaVersion.V3_0_0)
),
ScalacOption(s"-Wconf:$contextDeprecationInfo,$verboseWarnings", _ < ScalaVersion.V2_13_0)
ScalacOption(s"-Wconf:$deprecationInfo,$verboseWarnings", _ < ScalaVersion.V2_13_0)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ object CargoApp extends IOApp {

implicit val logMakeTraced: Logging.Make[TracedIO] = Logging.Make.contextual[TracedIO, Trace]
implicit val logMake: Logging.Make[IO] = Logging.Make.plain[IO]
implicit val appLogger = logMake.byName("CargoApp")
implicit val appLogger: Logging[IO] = logMake.byName("CargoApp")

val endpoints = Endpoints.cargoEndpoints[IO, TracedIO](
CargoService.make(MovingCompany.make[TracedIO], Warehouse.makeSmall[TracedIO])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ object CargoApp extends IOApp {

implicit val logMakeTraced: Logging.Make[TracedIO] = Logging.Make.contextual[TracedIO, Trace]
implicit val logMake: Logging.Make[IO] = Logging.Make.plain[IO]
implicit val appLogger = logMake.byName("CargoApp")
implicit val appLogger: Logging[IO] = logMake.byName("CargoApp")

val endpoints = Endpoints.cargoEndpoints[IO, TracedIO](
CargoService.make(MovingCompany.make[TracedIO], Warehouse.makeSmall[TracedIO])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ object CargoApp extends IOApp {

implicit val logMakeTraced: Logging.Make[TracedIO] = Logging.Make.contextual[TracedIO, Trace]
implicit val logMake: Logging.Make[IO] = Logging.Make.plain[IO]
implicit val appLogger = logMake.byName("CargoApp")
implicit val appLogger: Logging[IO] = logMake.byName("CargoApp")

val endpoints = Endpoints.cargoEndpoints[IO, TracedIO](
CargoService.make(MovingCompany.make[TracedIO], Warehouse.makeSmall[TracedIO])
Expand Down
7 changes: 4 additions & 3 deletions modules/core/ce2/src/test/scala/tofu/ScopedSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import scala.concurrent.ExecutionContext
import cats.effect.Blocker
import tofu.syntax.scoped.*
import tofu.syntax.monadic.*
import tofu.compat.unused
import scala.annotation.nowarn
import scala.concurrent.Future

class ScopedSuite {
@nowarn("cat=unused-params")
def doSomething[F[_]: ContextShift: Async, A](fa: F[A], ea: => A)(calcEc: ExecutionContext)(implicit
@unused ec: ExecutionContext,
@unused block: Blocker
ec: ExecutionContext,
block: Blocker
): F[List[A]] = {
implicit val exec: CalcExec[F] = Scoped.makeExecuteCE2(calcEc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ trait ContextTInstancesR extends ContextTInstancesS { self: ContextTInstances =>
final implicit def contextTContext[F[+_]: Applicative, C[_[_]]]: ContextTContext[F, C] =
new ContextTContext

final implicit def contextTNonEmptyParallel[F[+_]: NonEmptyParallel, C[_[_]]: InvariantK] =
new ContextTNonEmptyParallelI[F, C]
final implicit def contextTNonEmptyParallel[F[+_]: NonEmptyParallel, C[_[_]]: InvariantK]
: ContextTNonEmptyParallelI[F, C] = new ContextTNonEmptyParallelI[F, C]
}

trait ContextTInstancesQ extends ContextTInstancesR { self: ContextTInstances =>
Expand Down Expand Up @@ -175,7 +175,8 @@ trait ContextTInstancesP extends ContextTInstancesQ { self: ContextTInstances =>
rc1: Rebase[In],
): Unlift[ContextT[F, In, *], ContextT[F, Out, *]] = {
class uloi(implicit c2c: Out[ContextT[F, Out, *]]) extends Unlift[ContextT[F, Out, *], ContextT[F, In, *]] {
implicit def self = this
implicit def self: Unlift[ContextT[F, Out, *], ContextT[F, In, *]] = this

def lift[A](c2a: ContextT[F, Out, A]): ContextT[F, In, A] =
c1c => c2a.run(l.set(c2c, rc1.rebase(c1c)))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import tofu._
import zio._

import scala.annotation.nowarn
import tofu.compat.unused212

object ZioInstancesSuite {

Expand Down Expand Up @@ -42,7 +43,7 @@ object ZioInstancesSuite {
()
}

@nowarn("cat=unused-locals")
@unused212
def summonZioInstances[E, Ctx: Tag](): Unit = {
type ZContext = Has[Ctx]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object ZioHasBuilder {
class UnHas[U](val loggable: Loggable[U]) extends AnyVal

object UnHas {
implicit def unHas[S: Tag](implicit S: Loggable[S]) =
implicit def unHas[S: Tag](implicit S: Loggable[S]): UnHas[Has[S]] =
new UnHas[Has[S]](S.contramap(_.get))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait JsonEntryReader {
): List[JsonEntry] =
it.currentToken() match {
case token if token.isObjectEnd =>
it.nextToken()
val _ = it.nextToken()
builder.result()
case token if token.isFieldName =>
val name = it.fieldName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,6 @@ object Logs extends LogsInstances with LogsInstances0 {
}

/** Set of useful syntax stuff for Logs */
implicit def ops[I[_], F[_]](logs: Logs[I, F]) = new LogsInvariantSyntax.LogsOps[I, F](logs)
implicit def ops[I[_], F[_]](logs: Logs[I, F]): LogsInvariantSyntax.LogsOps[I, F] =
new LogsInvariantSyntax.LogsOps[I, F](logs)
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LoggableSuite extends AnyFlatSpec with Matchers {
json(TestInt(-1)) shouldBe """{"missing":null,"sign":"negative","value":-1}"""
}

implicit val testLoggableEither = Loggable.either[String, Int].named("kek")
implicit val testLoggableEither: Loggable[Either[String, Int]] = Loggable.either[String, Int].named("kek")

"either custom logging" should "handle left" in {
json("lol".asLeft[Int]) shouldBe """{"kek":"lol"}"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object WriterLogs extends Logs[Id, Writer[List[String], *]] {

class TestService {
type Run[A] = Writer[List[String], A]
implicit val logger = WriterLogs.byName("TestLogger")
implicit val logger: Logging[Writer[List[String], *]] = WriterLogs.byName("TestLogger")

def sayHello(name: String): Run[String] =
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import monix.reactive.observers.Subscriber

import scala.concurrent.Future
import scala.util.control.NonFatal
import monix.execution.Scheduler

//shameless copy of monix.reactive.internal.operators.TakeByPredicateOperator
private[observable] final case class TakeWhileInclusive[A](p: A => Boolean, out: Subscriber[A]) extends Subscriber[A] {
implicit val scheduler = out.scheduler
private[this] var isActive = true
implicit val scheduler: Scheduler = out.scheduler
private[this] var isActive = true

def onNext(elem: A): Future[Ack] = {
if (!isActive) Stop
Expand Down

0 comments on commit 77424f2

Please sign in to comment.