From a24f1740303f562734da1091e0a4c816bcbbcc4f Mon Sep 17 00:00:00 2001 From: Matt Dziuban Date: Thu, 22 Feb 2024 10:53:18 -0500 Subject: [PATCH] Remove manually set lint options, fix warnings in tests. --- .../main/scala/andxor/template/TypesTest.scala | 3 +-- scala-3/project/Build.scala | 6 ------ .../test/scala/andxor/AndXorProperties.scala | 17 +++++++++-------- .../tests/src/test/scala/andxor/TypesTest.scala | 1 - 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/scala-3/generate/src/main/scala/andxor/template/TypesTest.scala b/scala-3/generate/src/main/scala/andxor/template/TypesTest.scala index 6964871..8e37fad 100644 --- a/scala-3/generate/src/main/scala/andxor/template/TypesTest.scala +++ b/scala-3/generate/src/main/scala/andxor/template/TypesTest.scala @@ -3,7 +3,6 @@ package andxor.template object TypesTest { def apply(tpeLists: List[(List[String], Int)]) = s""" -import andxor.AndXorProperties.arbitrary.* import andxor.scalacheck.given import org.scalacheck.{Arbitrary, Properties} import cats.{Apply, Eq, Functor} @@ -51,7 +50,7 @@ object arbitrary { } ${tpeLists.map { case (_tpes, i) => - val tpes = _tpes.zipWithIndex.map { case (t, j) => if (j % 2 == 0) "String" else "Int" } + val tpes = _tpes.zipWithIndex.map { case (_, j) => if (j % 2 == 0) "String" else "Int" } val prodName = s"Prod${i}" val fTpes = (F: String) => tpes.map(t => s"$F[$t]") val prodTpe = (F: String) => (fTpes(F) :+ "EmptyTuple").mkString(" *: ") diff --git a/scala-3/project/Build.scala b/scala-3/project/Build.scala index 46aef81..a4d8719 100644 --- a/scala-3/project/Build.scala +++ b/scala-3/project/Build.scala @@ -9,12 +9,6 @@ object Build extends CommonBuild { val scalaVersions = Seq("3.3.1") val lintOpts = Seq( - "-Wvalue-discard", - "-Wunused:implicits", - "-Wunused:imports", - "-Wunused:locals", - "-Wunused:params", - "-Wunused:privates", "-Wunused:unsafe-warn-patvars", ) diff --git a/scala-3/tests/src/test/scala/andxor/AndXorProperties.scala b/scala-3/tests/src/test/scala/andxor/AndXorProperties.scala index c7bcf1c..8c25680 100644 --- a/scala-3/tests/src/test/scala/andxor/AndXorProperties.scala +++ b/scala-3/tests/src/test/scala/andxor/AndXorProperties.scala @@ -3,6 +3,7 @@ package andxor import cats.{~>, Applicative, Eq, Id} import cats.syntax.apply.* import org.scalacheck.{Arbitrary, Prop, PropFromFun, Properties} +import scala.util.chaining.* object AndXorProperties { object arbitrary { @@ -37,8 +38,8 @@ object AndXorProperties { def laws[F[_[_]]](implicit F: FFunctor[F], af: Arbitrary[F[Option]], axy: Arbitrary[Option ~> Option], ef: Eq[F[Option]]): Properties = newProperties("ffunctor") { p => - p.property.update("identity", identity[F, Option]): Unit - p.property.update("composite", composite[F, Option, Option, Option]): Unit + p.property.update("identity", identity[F, Option]).pipe(_ => ()) + p.property.update("composite", composite[F, Option, Option, Option]).pipe(_ => ()) } } @@ -76,13 +77,13 @@ object AndXorProperties { import arbitrary.* p.include(ffunctor.laws[F]) - p.property.update("identity", identity[F, TC, Option, Option]): Unit - p.property.update("purity.list", purity[F, TC, List, Option]): Unit - p.property.update("purity.stream", purity[F, TC, Vector, Option]): Unit - p.property.update("sequential fusion", sequentialFusion[F, TC, Id, Id, Option, Option, Option]): Unit + p.property.update("identity", identity[F, TC, Option, Option]).pipe(_ => ()) + p.property.update("purity.list", purity[F, TC, List, Option]).pipe(_ => ()) + p.property.update("purity.stream", purity[F, TC, Vector, Option]).pipe(_ => ()) + p.property.update("sequential fusion", sequentialFusion[F, TC, Id, Id, Option, Option, Option]).pipe(_ => ()) p.property.update("naturality", naturality[F, TC, Vector, List, Option]( - new (List ~> Vector) { def apply[A](l: List[A]): Vector[A] = l.toVector })): Unit - p.property.update("parallel fusion", parallelFusion[F, TC, Id, Id, Option, Option]): Unit + new (List ~> Vector) { def apply[A](l: List[A]): Vector[A] = l.toVector })).pipe(_ => ()) + p.property.update("parallel fusion", parallelFusion[F, TC, Id, Id, Option, Option]).pipe(_ => ()) } } } diff --git a/scala-3/tests/src/test/scala/andxor/TypesTest.scala b/scala-3/tests/src/test/scala/andxor/TypesTest.scala index 5e0b93d..850ee82 100644 --- a/scala-3/tests/src/test/scala/andxor/TypesTest.scala +++ b/scala-3/tests/src/test/scala/andxor/TypesTest.scala @@ -1,7 +1,6 @@ package andxor -import andxor.AndXorProperties.arbitrary.* import andxor.scalacheck.given import org.scalacheck.{Arbitrary, Properties} import cats.{Apply, Eq, Functor}