diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ec73ea69..ac909ab8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - scala: [2.11.12, 2.12.15, 2.13.8] - java: [adopt@1.8] + scala: [2.11.12, 2.12.19, 2.13.13] + java: [temurin@8] platform: [jvm, js, native] runs-on: ${{ matrix.os }} steps: @@ -34,10 +34,12 @@ jobs: with: fetch-depth: 0 - - name: Setup Java and Scala - uses: olafurpg/setup-scala@v10 + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v2 with: - java-version: ${{ matrix.java }} + distribution: temurin + java-version: 8 - name: Cache sbt uses: actions/cache@v2 @@ -75,8 +77,8 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.8] - java: [adopt@1.8] + scala: [2.13.13] + java: [temurin@8] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -84,10 +86,12 @@ jobs: with: fetch-depth: 0 - - name: Setup Java and Scala - uses: olafurpg/setup-scala@v10 + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v2 with: - java-version: ${{ matrix.java }} + distribution: temurin + java-version: 8 - name: Cache sbt uses: actions/cache@v2 @@ -108,4 +112,4 @@ jobs: PGP_SECRET: ${{ secrets.PGP_SECRET }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - run: sbt ++${{ matrix.scala }} ci-release \ No newline at end of file + run: sbt ++${{ matrix.scala }} ci-release diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml index b535fcc18..547aaa43e 100644 --- a/.github/workflows/clean.yml +++ b/.github/workflows/clean.yml @@ -56,4 +56,4 @@ jobs: printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size ghapi -X DELETE $REPO/actions/artifacts/$id done - done \ No newline at end of file + done diff --git a/build.sbt b/build.sbt index cd45f4dad..79fc796de 100644 --- a/build.sbt +++ b/build.sbt @@ -1,11 +1,11 @@ -import com.typesafe.sbt.SbtGit.GitKeys._ -import com.typesafe.tools.mima.core._ +import com.typesafe.sbt.SbtGit.GitKeys.* +import com.typesafe.tools.mima.core.* import sbtcrossproject.CrossPlugin.autoImport.crossProject import sbtcrossproject.CrossProject val Scala211 = "2.11.12" -val Scala212 = "2.12.15" -val Scala213 = "2.13.8" +val Scala212 = "2.12.19" +val Scala213 = "2.13.13" commonSettings noPublishSettings @@ -20,7 +20,7 @@ ThisBuild / versionScheme := Some("pvp") // GHA configuration ThisBuild / githubWorkflowBuildPreamble := Seq(WorkflowStep.Run(List("sudo apt install clang libunwind-dev libgc-dev libre2-dev"))) -ThisBuild / githubWorkflowJavaVersions := Seq("adopt@1.8") +ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")) ThisBuild / githubWorkflowArtifactUpload := false ThisBuild / githubWorkflowBuildMatrixAdditions += "platform" -> List("jvm", "js", "native") ThisBuild / githubWorkflowBuildMatrixFailFast := Some(false) @@ -73,13 +73,20 @@ val scalacOptionsAll = Seq( val scalacOptions212 = Seq( "-Xlint:-adapted-args,-delayedinit-select,-nullary-unit,-package-object-classes,-type-parameter-shadow,_", - "-Ywarn-unused:-implicits" + "-Wunused:-implicits", ) val scalacOptions213 = Seq( "-Xlint:-adapted-args,-delayedinit-select,-nullary-unit,-package-object-classes,-type-parameter-shadow,-byname-implicit,_", - "-Ywarn-unused:-implicits", - "-Wconf:msg=shadowing a nested class of a parent is deprecated:s" + "-Wunused:-implicits", + "-Wconf:msg=shadowing a nested class of a parent is deprecated:s", +) + +val scalacTestOptions213 = Seq( + "-Xlint:-infer-any,-named-booleans", + "-Wunused:-locals,-privates", + // Symbol.unapply returns Option + "-Wconf:cat=other-implicit-type:s,cat=other-match-analysis&src=*/lazy.scala:s", ) lazy val commonSettings = crossVersionSharedSources ++ Seq( @@ -87,11 +94,15 @@ lazy val commonSettings = crossVersionSharedSources ++ Seq( resolvers ++= Resolver.sonatypeOssRepos("snapshots"), incOptions := incOptions.value.withLogRecompileOnMacro(false), scalacOptions := scalacOptionsAll, - Compile / compile / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { + Compile / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { case Some((2, 12)) => scalacOptions212 case Some((2, 13)) => scalacOptions213 case _ => Nil }), + Test / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, 13)) => scalacTestOptions213 + case _ => Nil + }), Compile / console / scalacOptions -= "-Xfatal-warnings", Test / console / scalacOptions -= "-Xfatal-warnings", console / initialCommands := """import shapeless._""", @@ -182,17 +193,21 @@ lazy val examples = crossProject(JSPlatform, JVMPlatform, NativePlatform) .configureCross(configureJUnit) .dependsOn(core) .settings(moduleName := "examples") - .settings(libraryDependencies += "org.scala-lang.modules" %%% "scala-parser-combinators" % "2.1.1") + .settings(libraryDependencies += "org.scala-lang.modules" %%% "scala-parser-combinators" % "2.2.0") .settings(runAllIn(Compile)) .settings(commonSettings) .settings(noPublishSettings) .nativeSettings(Compile / sources ~= (_.filterNot(_.getName == "sexp.scala"))) + .settings(scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, 13)) => scalacTestOptions213 + case _ => Nil + })) lazy val examplesJVM = examples.jvm lazy val examplesJS = examples.js lazy val examplesNative = examples.native -lazy val crossVersionSharedSources: Seq[Setting[_]] = +lazy val crossVersionSharedSources: Seq[Setting[?]] = Seq(Compile, Test).map { sc => (sc / unmanagedSourceDirectories) ++= { (sc / unmanagedSourceDirectories).value.flatMap { dir: File => diff --git a/core/jvm/src/test/scala/shapeless/lazy.scala b/core/jvm/src/test/scala/shapeless/lazy.scala index c4733cde1..101904c31 100644 --- a/core/jvm/src/test/scala/shapeless/lazy.scala +++ b/core/jvm/src/test/scala/shapeless/lazy.scala @@ -16,10 +16,9 @@ package shapeless -import scala.language.reflectiveCalls - import org.junit.Test -import org.junit.Assert._ + +import scala.language.reflectiveCalls class LazyStrictTestsJVM { diff --git a/core/jvm/src/test/scala/shapeless/serialization.scala b/core/jvm/src/test/scala/shapeless/serialization.scala index a78e3be4c..c8939818c 100644 --- a/core/jvm/src/test/scala/shapeless/serialization.scala +++ b/core/jvm/src/test/scala/shapeless/serialization.scala @@ -16,25 +16,23 @@ package shapeless -import java.io._ - -import org.junit.Test import org.junit.Assert._ +import org.junit.Test +import shapeless.labelled._ +import shapeless.nat._ +import shapeless.ops.function._ +import shapeless.ops.nat._ +import shapeless.ops.traversable._ +import shapeless.poly.~>> +import shapeless.record._ +import shapeless.serializationtestutils._ +import shapeless.syntax.singleton._ +import shapeless.syntax.std.TupleOps +import shapeless.syntax.zipper._ +import shapeless.syntax._ +import shapeless.union._ -import labelled._ -import nat._ -import ops.function._ -import ops.nat._ -import ops.traversable._ -import poly.{ ~>> } -import record._ -import syntax.{ CoproductOps, GenericZipperOps, HListOps, HListZipperOps, NatOps, RecordOps, TypeableOps, UnionOps } -import syntax.std.TupleOps -import syntax.singleton._ -import syntax.zipper._ -import test._ -import serializationtestutils._ -import union._ +import java.io._ object SerializationTestDefns { diff --git a/core/shared/src/main/scala/shapeless/generic.scala b/core/shared/src/main/scala/shapeless/generic.scala index 96806393d..11c6776ec 100644 --- a/core/shared/src/main/scala/shapeless/generic.scala +++ b/core/shared/src/main/scala/shapeless/generic.scala @@ -959,7 +959,7 @@ trait CaseClassMacros extends ReprTypes with CaseClassMacrosVersionSpecifics { val repWCard = Star(wildcard) def narrow(tree: Tree, tpe: Type): Tree = tpe match { - case ConstantType(c) => q"$c.asInstanceOf[$tpe]" + case ConstantType(const) => q"$const.asInstanceOf[$tpe]" case _ => tree } diff --git a/core/shared/src/main/scala/shapeless/generic1.scala b/core/shared/src/main/scala/shapeless/generic1.scala index 237914c04..994514eb3 100644 --- a/core/shared/src/main/scala/shapeless/generic1.scala +++ b/core/shared/src/main/scala/shapeless/generic1.scala @@ -207,7 +207,7 @@ class Generic1Macros(val c: whitebox.Context) extends CaseClassMacros { def mkGeneric1Impl[T[_], FR[_[_]]](implicit tTag: WeakTypeTag[T[_]], frTag: WeakTypeTag[FR[Any]]): Tree = { val tpe = tTag.tpe.etaExpand val frTpe = c.openImplicits.headOption match { - case Some(ImplicitCandidate(_, _, TypeRef(_, _, List(_, tpe)), _)) => tpe + case Some(ImplicitCandidate(_, _, TypeRef(_, _, List(_, frTpe)), _)) => frTpe case _ => frTag.tpe.typeConstructor } diff --git a/core/shared/src/main/scala/shapeless/hlistconstraints.scala b/core/shared/src/main/scala/shapeless/hlistconstraints.scala index a2b8f8daa..ca6d5a5b2 100644 --- a/core/shared/src/main/scala/shapeless/hlistconstraints.scala +++ b/core/shared/src/main/scala/shapeless/hlistconstraints.scala @@ -72,8 +72,13 @@ object BasisConstraint { type λ[L <: HList] = BasisConstraint[L, M] } - implicit def hnilBasis[M <: HList] = new BasisConstraint[HNil, M] {} - implicit def hlistBasis[H, T <: HList, M <: HList](implicit bct : BasisConstraint[T, M], sel : Selector[M, H]) = + implicit def hnilBasis[M <: HList]: BasisConstraint[HNil, M] = + new BasisConstraint[HNil, M] {} + + implicit def hlistBasis[H, T <: HList, M <: HList](implicit + bct: BasisConstraint[T, M], + sel: Selector[M, H] + ): BasisConstraint[H :: T, M] = new BasisConstraint[H :: T, M] {} } @@ -89,8 +94,13 @@ object LUBConstraint { type λ[L <: HList] = LUBConstraint[L, B] } - implicit def hnilLUB[T] = new LUBConstraint[HNil, T] {} - implicit def hlistLUB[H, T <: HList, B](implicit bct : LUBConstraint[T, B], ev: H <:< B) = + implicit def hnilLUB[T]: LUBConstraint[HNil, T] = + new LUBConstraint[HNil, T] {} + + implicit def hlistLUB[H, T <: HList, B](implicit + bct: LUBConstraint[T, B], + ev: H <:< B + ): LUBConstraint[H :: T, B] = new LUBConstraint[H :: T, B] {} } @@ -108,9 +118,14 @@ object KeyConstraint { type λ[L <: HList] = KeyConstraint[L, M] } - implicit def hnilKeys[M <: HList] = new KeyConstraint[HNil, M] {} - implicit def hlistKeys[K, V, T <: HList, M <: HList] - (implicit bct : KeyConstraint[T, M], sel : Selector[M, K]) = new KeyConstraint[FieldType[K, V] :: T, M] {} + implicit def hnilKeys[M <: HList]: KeyConstraint[HNil, M] = + new KeyConstraint[HNil, M] {} + + implicit def hlistKeys[K, V, T <: HList, M <: HList](implicit + bct: KeyConstraint[T, M], + sel: Selector[M, K] + ): KeyConstraint[FieldType[K, V] :: T, M] = + new KeyConstraint[FieldType[K, V] :: T, M] {} } /** @@ -127,9 +142,14 @@ object ValueConstraint { type λ[L <: HList] = ValueConstraint[L, M] } - implicit def hnilValues[M <: HList] = new ValueConstraint[HNil, M] {} - implicit def hlistValues[K, V, T <: HList, M <: HList] - (implicit bct : ValueConstraint[T, M], sel : Selector[M, V]) = new ValueConstraint[FieldType[K, V] :: T, M] {} + implicit def hnilValues[M <: HList]: ValueConstraint[HNil, M] = + new ValueConstraint[HNil, M] {} + + implicit def hlistValues[K, V, T <: HList, M <: HList](implicit + bct: ValueConstraint[T, M], + sel: Selector[M, V] + ): ValueConstraint[FieldType[K, V] :: T, M] = + new ValueConstraint[FieldType[K, V] :: T, M] {} } /** @@ -146,8 +166,13 @@ object NotContainsConstraint { type λ[L <: HList] = NotContainsConstraint[L, U] } - implicit def hnilNotContains[U] = new NotContainsConstraint[HNil, U] {} - implicit def hlistNotContains[H, T <: HList, U](implicit nc: T NotContainsConstraint U, neq: U =:!= H) = + implicit def hnilNotContains[U]: NotContainsConstraint[HNil, U] = + new NotContainsConstraint[HNil, U] {} + + implicit def hlistNotContains[H, T <: HList, U](implicit + nc: T NotContainsConstraint U, + neq: U =:!= H + ): NotContainsConstraint[H :: T, U] = new NotContainsConstraint[H :: T, U] {} } @@ -161,8 +186,12 @@ object IsDistinctConstraint { def apply[L <: HList](implicit idc: IsDistinctConstraint[L]): IsDistinctConstraint[L] = idc - implicit def hnilIsDistinct = new IsDistinctConstraint[HNil] {} - implicit def hlistIsDistinct[H, T <: HList](implicit d: IsDistinctConstraint[T], - nc: NotContainsConstraint[T, H]): IsDistinctConstraint[H :: T] = + implicit def hnilIsDistinct: IsDistinctConstraint[HNil] = + new IsDistinctConstraint[HNil] {} + + implicit def hlistIsDistinct[H, T <: HList](implicit + d: IsDistinctConstraint[T], + nc: NotContainsConstraint[T, H] + ): IsDistinctConstraint[H :: T] = new IsDistinctConstraint[H :: T] {} } diff --git a/core/shared/src/main/scala/shapeless/hlists.scala b/core/shared/src/main/scala/shapeless/hlists.scala index adce7fa64..9b576a019 100644 --- a/core/shared/src/main/scala/shapeless/hlists.scala +++ b/core/shared/src/main/scala/shapeless/hlists.scala @@ -118,8 +118,8 @@ object HList extends Dynamic { @tailrec def unsafeGet(l: HList, i: Int): Any = (l: @unchecked) match { - case hd :: tl if i == 0 => hd - case hd :: tl => unsafeGet(tl, i-1) + case hd :: _ if i == 0 => hd + case _ :: tl => unsafeGet(tl, i-1) } def unsafeReversePrepend(l: HList, m: HList): HList = { @@ -142,7 +142,7 @@ object HList extends Dynamic { @tailrec def loop(l: HList, i: Int, revPrefix: HList): HList = (l: @unchecked) match { - case hd :: tl if i == 0 => unsafeReversePrepend(revPrefix, e :: tl) + case _ :: tl if i == 0 => unsafeReversePrepend(revPrefix, e :: tl) case hd :: tl => loop(tl, i-1, hd :: revPrefix) } loop(l, i, HNil) @@ -153,7 +153,7 @@ object HList extends Dynamic { def loop(l: HList, i: Int, revPrefix: HList): HList = l match { case HNil => unsafeReversePrepend(revPrefix, e :: HNil) - case hd :: tl if i == 0 => unsafeReversePrepend(revPrefix, e :: tl) + case _ :: tl if i == 0 => unsafeReversePrepend(revPrefix, e :: tl) case hd :: tl => loop(tl, i-1, hd :: revPrefix) } loop(l, i, HNil) @@ -284,17 +284,20 @@ trait SingletonProductArgs extends Dynamic { class ProductMacros(val c: whitebox.Context) extends SingletonTypeUtils with NatMacroDefns { import c.universe._ - def forwardImpl(method: Tree)(args: Tree*): Tree = forward(method, args, false) + def forwardImpl(method: Tree)(args: Tree*): Tree = + forward(method, args, narrow = false) - def forwardNatImpl(method: Tree)(args: Tree*): Tree = forwardNat(method, args) + def forwardNatImpl(method: Tree)(args: Tree*): Tree = + forwardNat(method, args) - def forwardSingletonImpl(method: Tree)(args: Tree*): Tree = forward(method, args, true) + def forwardSingletonImpl(method: Tree)(args: Tree*): Tree = + forward(method, args, narrow = true) def forwardNat(method: Tree, args: Seq[Tree]): Tree = { val lhs = c.prefix.tree val lhsTpe = lhs.tpe - val q"${methodString: String}" = (method: @unchecked) + val q"${methodString: String}" = method: @unchecked val methodName = TermName(methodString+"NatProduct") if(lhsTpe.member(methodName) == NoSymbol) @@ -302,9 +305,9 @@ class ProductMacros(val c: whitebox.Context) extends SingletonTypeUtils with Nat val meth = lhsTpe.member(methodName).asMethod - if (!meth.paramLists.isEmpty && (meth.paramLists(0) forall (_.isImplicit))) { + if (meth.paramLists.nonEmpty && meth.paramLists.head.forall(_.isImplicit)) { val typeParamsTree = mkProductNatTypeParamsImpl(args) - q""" $lhs.$methodName[${typeParamsTree}] """ + q""" $lhs.$methodName[$typeParamsTree] """ } else { val argsTree = mkProductNatImpl(args) q""" $lhs.$methodName($argsTree) """ @@ -315,7 +318,7 @@ class ProductMacros(val c: whitebox.Context) extends SingletonTypeUtils with Nat val lhs = c.prefix.tree val lhsTpe = lhs.tpe - val q"${methodString: String}" = (method: @unchecked) + val q"${methodString: String}" = method: @unchecked val methodName = TermName(methodString+"Product") if(lhsTpe.member(methodName) == NoSymbol) @@ -330,7 +333,7 @@ class ProductMacros(val c: whitebox.Context) extends SingletonTypeUtils with Nat val lhs = c.prefix.tree val lhsTpe = lhs.tpe - val q"${methodString: String}" = (method: @unchecked) + val q"${methodString: String}" = method: @unchecked if (!methodString.matches(".*Product$")) c.abort(c.enclosingPosition, s"missing method '$methodString'") @@ -378,6 +381,6 @@ class ProductMacros(val c: whitebox.Context) extends SingletonTypeUtils with Nat .foldLeft((List[List[Int]](), 0))((acc, e) => (acc._1 :+ (acc._2 to (acc._2 + (e.size - 1))).toList, acc._2 + e.size))._1 - slices.map(_.map(i => q"${product}.apply(${i})")) + slices.map(_.map(i => q"$product.apply($i)")) } } diff --git a/core/shared/src/main/scala/shapeless/ops/coproduct.scala b/core/shared/src/main/scala/shapeless/ops/coproduct.scala index d711eb79a..39e3f3af6 100644 --- a/core/shared/src/main/scala/shapeless/ops/coproduct.scala +++ b/core/shared/src/main/scala/shapeless/ops/coproduct.scala @@ -48,12 +48,13 @@ object coproduct { implicit def hdSelector[H, T <: Coproduct]: Selector[H :+: T, H] = new Selector[H :+: T, H] { def apply(c: H :+: T): Option[H] = c match { case Inl(h) => Some(h) - case Inr(t) => None + case Inr(_) => None } } + implicit def tlSelector[H, T <: Coproduct, S](implicit st: Selector[T, S]): Selector[H :+: T, S] = new Selector[H :+: T, S] { def apply(c: H :+: T): Option[S] = c match { - case Inl(h) => None + case Inl(_) => None case Inr(t) => st(t) } } @@ -141,9 +142,9 @@ object coproduct { def coproduct(c: H :+: T): Prefix :+: Suffix :+: CNil = c match { case Inl(h) => Inr(Inl(Inl(h))) case Inr(t) => partition.coproduct(t) match { - case Inl(h) => Inl(h) + case Inl(h) => Inl(h) case Inr(Inl(t)) => Inr(Inl(Inr(t))) - case Inr(Inr(c)) => Inr(Inr(c)) + case Inr(Inr(nil)) => Inr(Inr(nil)) } } } diff --git a/core/shared/src/main/scala/shapeless/poly.scala b/core/shared/src/main/scala/shapeless/poly.scala index cd73c6ddf..aea13d92a 100644 --- a/core/shared/src/main/scala/shapeless/poly.scala +++ b/core/shared/src/main/scala/shapeless/poly.scala @@ -170,11 +170,11 @@ object PolyDefns extends Cases { * Base class for lifting a `Function1` to a `Poly1` */ class ->[T, R](f : T => R) extends Poly1 { - implicit def subT[U <: T]: Case.Aux[U, R] = at[U](f) + implicit def subT[U <: T]: this.Case.Aux[U, R] = at[U](f) } trait LowPriorityLiftFunction1 extends Poly1 { - implicit def default[T]: Case.Aux[T, HNil] = at[T](_ => HNil : HNil) + implicit def default[T]: this.Case.Aux[T, HNil] = at[T](_ => HNil : HNil) } /** @@ -182,7 +182,7 @@ object PolyDefns extends Cases { * its only element if the argument is in the original functions domain, `HNil` otherwise. */ class >->[T, R](f : T => R) extends LowPriorityLiftFunction1 { - implicit def subT[U <: T]: Case.Aux[U, R :: HNil] = at[U](f(_) :: HNil) + implicit def subT[U <: T]: this.Case.Aux[U, R :: HNil] = at[U](f(_) :: HNil) } trait LowPriorityLiftU extends Poly { @@ -210,7 +210,7 @@ object PolyDefns extends Cases { */ trait ~>[F[_], G[_]] extends Poly1 { def apply[T](f : F[T]) : G[T] - implicit def caseUniv[T]: Case.Aux[F[T], G[T]] = at[F[T]](apply(_)) + implicit def caseUniv[T]: this.Case.Aux[F[T], G[T]] = at[F[T]](apply(_)) } object ~> { diff --git a/core/shared/src/main/scala/shapeless/singletons.scala b/core/shared/src/main/scala/shapeless/singletons.scala index 5b4fa8e92..d50d4e110 100644 --- a/core/shared/src/main/scala/shapeless/singletons.scala +++ b/core/shared/src/main/scala/shapeless/singletons.scala @@ -308,17 +308,11 @@ class SingletonTypeMacros(val c: whitebox.Context) extends SingletonTypeUtils wi def extractSingletonValue(tpe: Type): Tree = tpe match { case ConstantType(Constant(s: scala.Symbol)) => mkSingletonSymbol(s.name) - - case ConstantType(c: Constant) => Literal(c) - + case ConstantType(const: Constant) => Literal(const) case SingleType(p, v) => mkAttributedRef(p, v) - - case SingletonSymbolType(c) => mkSingletonSymbol(c) - + case SingletonSymbolType(sym) => mkSingletonSymbol(sym) case ThisType(sym) => This(sym) - - case _ => - c.abort(c.enclosingPosition, s"Type argument $tpe is not a singleton type") + case _ => c.abort(c.enclosingPosition, s"Type argument $tpe is not a singleton type") } def materializeImpl[T: WeakTypeTag]: Tree = { diff --git a/core/shared/src/main/scala/shapeless/typeable.scala b/core/shared/src/main/scala/shapeless/typeable.scala index 46abeb9db..a53463320 100644 --- a/core/shared/src/main/scala/shapeless/typeable.scala +++ b/core/shared/src/main/scala/shapeless/typeable.scala @@ -329,8 +329,8 @@ class TypeableMacros(val c: blackbox.Context) extends SingletonTypeUtils { c.abort(c.enclosingPosition, s"No default Typeable for parametrized type $tpe") normalizedTypeable - case SingletonSymbolType(c) => - q"""_root_.shapeless.Typeable.valueSingletonTypeable[$tpe](${mkSingletonSymbol(c)}, "Symbol")""" + case SingletonSymbolType(const) => + q"""_root_.shapeless.Typeable.valueSingletonTypeable[$tpe](${mkSingletonSymbol(const)}, "Symbol")""" case RefinedType(parents, decls) => if (decls.nonEmpty) @@ -367,8 +367,8 @@ class TypeableMacros(val c: blackbox.Context) extends SingletonTypeUtils { $v.asInstanceOf[$tpe], ${nameOf(v)}, serializable = ${v.isModule} )""" - case ConstantType(c) => - q"""_root_.shapeless.Typeable.valueSingletonTypeable[$tpe]($c.asInstanceOf[$tpe], ${nameOf(c.tpe)})""" + case ConstantType(const) => + q"""_root_.shapeless.Typeable.valueSingletonTypeable[$tpe]($const.asInstanceOf[$tpe], ${nameOf(const.tpe)})""" // Outer#Inner is unsound in general since Inner can capture type members of Outer. case TypeRef(TypeRef(_, outer, args), inner, _) if !outer.isFinal || args.nonEmpty => diff --git a/core/shared/src/test/scala/shapeless/alacarte.scala b/core/shared/src/test/scala/shapeless/alacarte.scala index f79bce1b9..ca3df3eab 100644 --- a/core/shared/src/test/scala/shapeless/alacarte.scala +++ b/core/shared/src/test/scala/shapeless/alacarte.scala @@ -39,7 +39,7 @@ class ALaCarteTests { val foo = Foo(23, "foo") typed[Foo](foo) - val Foo(i, s) = foo + val Foo(i, s) = foo: @unchecked typed[Int](i) typed[String](s) } diff --git a/core/shared/src/test/scala/shapeless/fin.scala b/core/shared/src/test/scala/shapeless/fin.scala index 0fb911d59..84bd5f60c 100644 --- a/core/shared/src/test/scala/shapeless/fin.scala +++ b/core/shared/src/test/scala/shapeless/fin.scala @@ -17,16 +17,12 @@ package shapeless import org.junit.Test -import org.junit.Assert._ - -import test._ -import testutil._ +import shapeless.test._ +import shapeless.testutil._ class FinTests { import nat._ - import fin._ - import ops.fin._ @Test def testFromNats: Unit = { diff --git a/core/shared/src/test/scala/shapeless/generic.scala b/core/shared/src/test/scala/shapeless/generic.scala index 9aa6610d6..b66c0b420 100644 --- a/core/shared/src/test/scala/shapeless/generic.scala +++ b/core/shared/src/test/scala/shapeless/generic.scala @@ -16,12 +16,11 @@ package shapeless -import org.junit.Test import org.junit.Assert._ - -import ops.{ hlist => hl, coproduct => cp } -import testutil.assertTypedEquals -import test.illTyped +import org.junit.Test +import shapeless.ops.{coproduct => cp, hlist => hl} +import shapeless.test.illTyped +import shapeless.testutil.assertTypedEquals package GenericTestsAux { sealed trait Fruit @@ -105,7 +104,7 @@ package GenericTestsAux { class NonCCWithCompanion private (val i: Int, val s: String) object NonCCWithCompanion { def apply(i: Int, s: String) = new NonCCWithCompanion(i, s) - def unapply(s: NonCCWithCompanion): Option[(Int, String)] = Some((s.i, s.s)) + def unapply(s: NonCCWithCompanion): Some[(Int, String)] = Some((s.i, s.s)) } class NonCCLazy(prev0: => NonCCLazy, next0: => NonCCLazy) { @@ -182,7 +181,6 @@ package GenericTestsAux { class GenericTests { import GenericTestsAux._ - import scala.collection.immutable.{ :: => Cons } import test._ type ABP = Apple :+: Banana :+: Pear :+: CNil @@ -444,7 +442,7 @@ class GenericTests { @Test def testParametrizedWithVarianceList: Unit = { - import scala.collection.immutable.{ :: => Cons } + import scala.collection.immutable.{:: => Cons} val l: List[Int] = List(1, 2, 3) type CN = Cons[Int] :+: Nil.type :+: CNil @@ -611,8 +609,6 @@ class GenericTests { @Test def testIsTuple: Unit = { - import record._ - import union._ IsTuple[Unit] IsTuple[(Int, String)] @@ -634,8 +630,6 @@ class GenericTests { @Test def testHasProductGeneric: Unit = { - import record._ - import union._ HasProductGeneric[Single] HasProductGeneric[Person] @@ -659,8 +653,6 @@ class GenericTests { @Test def testHasCoproductGeneric: Unit = { - import record._ - import union._ HasCoproductGeneric[Fruit] @@ -682,8 +674,6 @@ class GenericTests { @Test def testNonGeneric: Unit = { - import record._ - import union._ illTyped(" Generic[Int] ") illTyped(" Generic[Array[Int]] ") @@ -1331,7 +1321,6 @@ object PrivateCtorDefns { } object PrivateCtor { - import PrivateCtorDefns._ illTyped(""" Generic[Access.PublicFamily] diff --git a/core/shared/src/test/scala/shapeless/generic1.scala b/core/shared/src/test/scala/shapeless/generic1.scala index c00d61b29..36d0654bb 100644 --- a/core/shared/src/test/scala/shapeless/generic1.scala +++ b/core/shared/src/test/scala/shapeless/generic1.scala @@ -16,10 +16,9 @@ package shapeless -import org.junit.Test import org.junit.Assert._ - -import test._ +import org.junit.Test +import shapeless.test._ package Generic1TestsAux { trait TC1[F[_]] @@ -413,7 +412,6 @@ class Generic1Tests { @Test def testPointed: Unit = { - import pointedSyntax._ type R0[t] = None.type :: HNil IsHCons1[R0, Pointed, Pointed] diff --git a/core/shared/src/test/scala/shapeless/hlist.scala b/core/shared/src/test/scala/shapeless/hlist.scala index ce8f7d246..c6b7e1e4d 100644 --- a/core/shared/src/test/scala/shapeless/hlist.scala +++ b/core/shared/src/test/scala/shapeless/hlist.scala @@ -16,19 +16,18 @@ package shapeless -import org.junit.Test import org.junit.Assert._ -import test._ -import testutil._ +import org.junit.Test +import shapeless.test._ +import shapeless.testutil._ class HListTests { import nat._ + import ops.hlist._ + import ops.record.SelectAll import poly._ import syntax.std.traversable._ - import syntax.singleton._ import syntax.typeable._ - import ops.hlist._ - import ops.record.SelectAll type SI = Set[Int] :: HNil type OI = Option[Int] :: HNil @@ -1891,7 +1890,7 @@ class HListTests { val mixed = 23 :: "foo" :: (1 :: 2 :: 3 :: 4 :: 5 :: Nil) :: false :: () :: HNil val tmixed = mixed match { - case _ #: _ #: (_ :: 2 :: x :: tl1) #: tl2 => (x, tl1, tl2) + case _ #: _ #: (_ :: 2 :: x :: tail1) #: tail2 => (x, tail1, tail2) case _ => sys.error("Not matched") } assertTypedEquals[Int](3, tmixed._1) @@ -2194,7 +2193,6 @@ class HListTests { @Test def testZipWith: Unit = { - import poly._ object empty extends Poly2 @@ -3116,7 +3114,8 @@ class HListTests { @Test def selectAllTest: Unit ={ - import shapeless._, record._ , ops.hlist.SelectAll + import ops.hlist.SelectAll + import record._ //is there any way to do it without runtime overhead? class TypeCaptured[T](val value: T) { @@ -3230,42 +3229,42 @@ class HListTests { ) = mapper(range()) // group HNil - assertEquals(HNil: HNil, (HNil: HNil) group(2, 1)) + assertEquals(HNil: HNil, (HNil: HNil).group(2, 1)) // group a HList of 4 items into 2 (4/2) tuples of 2 items assertEquals( (0, 1) ::(2, 3) :: HNil, - range(0, 4) group(2, 2) + range(0, 4).group(2, 2) ) // group a HList of 5 items into 2 (5/2) tuples of 2 items // the last item does not make a complete partition and is dropped. assertEquals( (0, 1) ::(2, 3) :: HNil, - range(0, 5) group(2, 2) + range(0, 5).group(2, 2) ) // uses the step to select the starting point for each partition assertEquals( (0, 1) ::(4, 5) :: HNil, - range(0, 6) group(2, 4) + range(0, 6).group(2, 4) ) // if the step is smaller than the partition size, items will be reused assertEquals( (0, 1) ::(1, 2) ::(2, 3) :: HNil, - range(0, 4) group(2, 1) + range(0, 4).group(2, 1) ) // when there are not enough items to fill the last partition, a pad can be supplied. assertEquals( (0, 1) ::(2, 3) ::(4, 'a') :: HNil, - range(0, 5) group(2, 2, 'a' :: HNil) + range(0, 5).group(2, 2, 'a' :: HNil) ) // but only as many pad elements are used as necessary to fill the final partition. assertEquals( (0, 1) ::(2, 3) ::(4, 'a') :: HNil, - range(0, 5) group(2, 2, 'a' :: 'b' :: 'c' :: HNil) + range(0, 5).group(2, 2, 'a' :: 'b' :: 'c' :: HNil) ) } diff --git a/core/shared/src/test/scala/shapeless/hlistconstraints.scala b/core/shared/src/test/scala/shapeless/hlistconstraints.scala index 1b4ec8b67..e4db39d2b 100644 --- a/core/shared/src/test/scala/shapeless/hlistconstraints.scala +++ b/core/shared/src/test/scala/shapeless/hlistconstraints.scala @@ -17,8 +17,6 @@ package shapeless import org.junit.Test -import org.junit.Assert._ - import shapeless.test.illTyped class HListConstraintsTests { diff --git a/core/shared/src/test/scala/shapeless/implicits.scala b/core/shared/src/test/scala/shapeless/implicits.scala index 1bf862fe4..57d364e5b 100644 --- a/core/shared/src/test/scala/shapeless/implicits.scala +++ b/core/shared/src/test/scala/shapeless/implicits.scala @@ -16,11 +16,10 @@ package shapeless -import org.junit.Test import org.junit.Assert._ - -import labelled.FieldType -import test.illTyped +import org.junit.Test +import shapeless.labelled.FieldType +import shapeless.test.illTyped object CachedTestDefns { trait CachedTC[T] @@ -84,7 +83,6 @@ object CachedTestDefns { class CachedTest { import CachedTestDefns._ - import CachedTest._ @Test def testBasics: Unit = { diff --git a/core/shared/src/test/scala/shapeless/labelledgeneric.scala b/core/shared/src/test/scala/shapeless/labelledgeneric.scala index 1fd293e78..226f78aea 100644 --- a/core/shared/src/test/scala/shapeless/labelledgeneric.scala +++ b/core/shared/src/test/scala/shapeless/labelledgeneric.scala @@ -75,7 +75,7 @@ object LabelledGenericTestsAux { class NonCCWithCompanion private (val i: Int, val s: String) object NonCCWithCompanion { def apply(i: Int, s: String) = new NonCCWithCompanion(i, s) - def unapply(s: NonCCWithCompanion): Option[(Int, String)] = Some((s.i, s.s)) + def unapply(s: NonCCWithCompanion): Some[(Int, String)] = Some((s.i, s.s)) } class NonCCLazy(prev0: => NonCCLazy, next0: => NonCCLazy) { diff --git a/core/shared/src/test/scala/shapeless/lenses.scala b/core/shared/src/test/scala/shapeless/lenses.scala index df06faa07..d0cb610b3 100644 --- a/core/shared/src/test/scala/shapeless/lenses.scala +++ b/core/shared/src/test/scala/shapeless/lenses.scala @@ -16,10 +16,12 @@ package shapeless -import org.junit.Test import org.junit.Assert._ - -import lens._, nat._, record._, syntax.singleton._, tag.@@, test._, testutil._ +import org.junit.Test +import shapeless.lens._ +import shapeless.nat._ +import shapeless.test._ +import shapeless.testutil._ package lensTestDataTypes { sealed trait Sum1 @@ -49,7 +51,7 @@ package lensTestDataTypes { } } -import lensTestDataTypes._ +import shapeless.lensTestDataTypes._ trait LensTests { val address = Address("Southover Street", "Brighton", "BN2 9UA") @@ -208,7 +210,8 @@ trait LensTests { @Test def testRecords: Unit = { - import labelled.FieldType, syntax.singleton._ + import labelled.FieldType + import syntax.singleton._ val (fooT, barT) = (Witness("foo"), Witness("bar")) type LT = (fooT.T FieldType Int) :: (barT.T FieldType String) :: HNil @@ -716,13 +719,13 @@ class OpticTests { val lrv = tOptic.left.right.value val rv = tOptic.right.value - val llv(x) = t1 + val llv(x) = t1: @unchecked assertTypedEquals[Int](1, x) - val lrv(y) = t1 + val lrv(y) = t1: @unchecked assertTypedEquals[Int](2, y) - val rv(z) = t1 + val rv(z) = t1: @unchecked assertTypedEquals[Int](3, z) val x2 = t2 match { @@ -744,7 +747,7 @@ class OpticTests { assertTypedEquals[Option[Int]](None, z2) val llvrv = llv ~ lrv ~ rv - val llvrv(x3, y3, z3) = t1 + val llvrv(x3, y3, z3) = t1: @unchecked assertTypedEquals[Int](1, x3) assertTypedEquals[Int](2, y3) assertTypedEquals[Int](3, z3) @@ -764,18 +767,18 @@ class OpticTests { val rrrrlv = g.right.right.right.right.left.value val looped = rrrlv ~ rrrrlv - val rll(a, b) = new BNode(BTerm(1), new BNode(BTerm(2), BTerm(3))) + val rll(a, b) = new BNode(BTerm(1), new BNode(BTerm(2), BTerm(3))): @unchecked assertEquals(BTerm(2), a) assertEquals(BTerm(1), b) - lazy val g0 @ rll(x: BTerm[Int], y: BTerm[Int]) = new BNode(BTerm(1), new BNode(BTerm(2), new BNode(x, y))) - val rrlvrrrv(x1, y1) = g0 + lazy val g0 @ rll(x: BTerm[Int], y: BTerm[Int]) = new BNode(BTerm(1), new BNode(BTerm(2), new BNode(x, y))): @unchecked + val rrlvrrrv(x1, y1) = g0: @unchecked assertEquals(2, x1) assertEquals(1, y1) - lazy val rlg(z: BTerm[Int], g1: BGraph[Int]) = new BNode(BTerm(1), new BNode(BTerm(2), new BNode(z, g1))) + lazy val rlg(z: BTerm[Int], g1: BGraph[Int]) = new BNode(BTerm(1), new BNode(BTerm(2), new BNode(z, g1))): @unchecked - val looped(x2, y2) = g1 + val looped(x2, y2) = g1: @unchecked assertEquals(1, x2) assertEquals(2, y2) } diff --git a/core/shared/src/test/scala/shapeless/natranges.scala b/core/shared/src/test/scala/shapeless/natranges.scala index 71342a7d7..ade9139ca 100644 --- a/core/shared/src/test/scala/shapeless/natranges.scala +++ b/core/shared/src/test/scala/shapeless/natranges.scala @@ -16,7 +16,6 @@ package shapeless -import org.junit.Assert._ import org.junit.Test class natranges { @@ -41,7 +40,7 @@ class natranges { @Test def smallest_closed_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.Inclusive assertTypedEquals[ _1 :: HNil ]( @@ -64,7 +63,7 @@ class natranges { @Test def smallest_open_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.Exclusive assertTypedEquals[ HNil ]( @@ -87,7 +86,7 @@ class natranges { @Test def smallest_leftOpenRightClosed_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.{Exclusive, Inclusive} assertTypedEquals[ _1 :: HNil ]( @@ -110,7 +109,7 @@ class natranges { @Test def smallest_leftClosedRightOpen_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.{Exclusive, Inclusive} assertTypedEquals[ _1 :: HNil ]( @@ -136,7 +135,7 @@ class natranges { @Test def larger_closed_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.Inclusive assertTypedEquals[ _1 :: _2 :: _3 :: _4 :: HNil ]( @@ -159,7 +158,7 @@ class natranges { @Test def larger_open_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.Exclusive assertTypedEquals[ _2 :: _3 :: HNil ]( @@ -182,7 +181,7 @@ class natranges { @Test def larger_leftClosedRightOpen_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.{Exclusive, Inclusive} assertTypedEquals[ _1 :: _2 :: _3 :: HNil ]( @@ -205,7 +204,7 @@ class natranges { @Test def larger_leftOpenRightClosed_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.{Exclusive, Inclusive} assertTypedEquals[ _2 :: _3 :: _4 :: HNil ]( @@ -231,7 +230,7 @@ class natranges { @Test def reversed_closed_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.Inclusive assertTypedEquals[ _4 :: _3 :: _2 :: _1 :: HNil ]( @@ -254,7 +253,7 @@ class natranges { @Test def reversed_open_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.Exclusive assertTypedEquals[ _3 :: _2 :: HNil ]( @@ -277,7 +276,7 @@ class natranges { @Test def reversed_leftClosedRightOpen_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.{Exclusive, Inclusive} assertTypedEquals[ _4 :: _3 :: _2 :: HNil ]( @@ -300,7 +299,7 @@ class natranges { @Test def reversed_leftOpenRightClosed_range_word_syntax = { import ops.nat.BoundedRange - import BoundedRange.{Inclusive, Exclusive} + import BoundedRange.{Exclusive, Inclusive} assertTypedEquals[ _3 :: _2 :: _1 :: HNil ]( diff --git a/core/shared/src/test/scala/shapeless/records.scala b/core/shared/src/test/scala/shapeless/records.scala index 2ac446415..e016ec095 100644 --- a/core/shared/src/test/scala/shapeless/records.scala +++ b/core/shared/src/test/scala/shapeless/records.scala @@ -16,8 +16,8 @@ package shapeless -import org.junit.Test import org.junit.Assert._ +import org.junit.Test import shapeless.ops.record.AlignByKeys class RecordTests { @@ -30,7 +30,7 @@ class RecordTests { import testutil._ // making it method local causes weird compile error in Scala 2.10 - import ops.record.{ RemoveAll, UnzipFields } + import ops.record.{RemoveAll, UnzipFields} object intField1 extends FieldOf[Int] object intField2 extends FieldOf[Int] @@ -742,7 +742,6 @@ class RecordTests { @Test def testFieldPoly: Unit = { - import poly._ object f extends FieldPoly { implicit def atFoo = atField[Int]("foo")(_ + 1) @@ -761,7 +760,6 @@ class RecordTests { @Test def testFieldPolyOnRecord: Unit = { - import poly._ object f extends FieldPoly { implicit def atFoo = atField[Int]("foo")(_ + 1) @@ -782,7 +780,6 @@ class RecordTests { @Test def testFieldPolyNested: Unit = { - import poly._ object f extends FieldPoly { implicit def atFoo = atField[Int]("foo")(_ + 1) @@ -790,7 +787,7 @@ class RecordTests { val r = List(List(List(("foo" ->> 23) :: ("bar" ->> true) :: HNil))) - val List(List(List(r1))) = everywhere(f)(r) + val List(List(List(r1))) = everywhere(f)(r): @unchecked val v1 = r1("foo") typed[Int](v1) @@ -1145,7 +1142,7 @@ class RecordTests { @Test def testSelectorForSwappedRecord: Unit = { - import ops.record.{ Selector, SwapRecord } + import ops.record.{Selector, SwapRecord} val gen = LabelledGeneric[Bar] val swap = SwapRecord[gen.Repr] diff --git a/core/shared/src/test/scala/shapeless/sized.scala b/core/shared/src/test/scala/shapeless/sized.scala index 5188a5040..396d11984 100644 --- a/core/shared/src/test/scala/shapeless/sized.scala +++ b/core/shared/src/test/scala/shapeless/sized.scala @@ -138,10 +138,10 @@ class SizedTests { val evens = cl.get.filter(_ % 2 == 0) val p = cl.get match { - case Sized(a, b, _*) => { - typed[Int](a) - typed[Int](b) - (a-b, a+b) + case Sized(x, y, _*) => { + typed[Int](x) + typed[Int](y) + (x-y, x+y) } case _ => (9, 10) } diff --git a/core/shared/src/test/scala/shapeless/tuples.scala b/core/shared/src/test/scala/shapeless/tuples.scala index 32e89d6be..ae56f7e58 100644 --- a/core/shared/src/test/scala/shapeless/tuples.scala +++ b/core/shared/src/test/scala/shapeless/tuples.scala @@ -25,7 +25,6 @@ import testutil._ class TupleTests { import nat._ import poly._ - import syntax.std.traversable._ import syntax.std.tuple._ import syntax.typeable._ @@ -1799,43 +1798,43 @@ class TupleTests { // Note: Slightly different method signature in testGrouper2 // group Unit - assertEquals( (), () group (2,1) ) + assertEquals((), ().group(2,1)) // partition a Tuple of 4 items into 2 (4/2) tuples of 2 items assertEquals( ((0, 1), (2, 3)), - range(0, 4) group(2, 2) + range(0, 4).group(2, 2) ) // partition a Tuple of 5 items into 2 (5/2) tuples of 2 items // the last item does not make a complete partition and is dropped. assertEquals( ((0, 1), (2, 3)), - range(0, 5) group(2, 2) + range(0, 5).group(2, 2) ) // uses the step to select the starting point for each partition assertEquals( ((0, 1), (4, 5)), - range(0, 6) group(2, 4) + range(0, 6).group(2, 4) ) // if the step is smaller than the partition size, items will be reused assertEquals( ((0, 1), (1, 2), (2, 3)), - range(0, 4) group(2, 1) + range(0, 4).group(2, 1) ) // when there are not enough items to fill the last partition, a pad can be supplied. assertEquals( ((0, 1), (2, 3), (4, 'a')), - range(0, 5) group(2, 2, Tuple1('a')) + range(0, 5).group(2, 2, Tuple1('a')) ) // but only as many pad elements are used as necessary to fill the final partition. assertEquals( ((0, 1), (2, 3), (4, 'a')), - range(0, 5) group(2, 2, ('a', 'b', 'c')) + range(0, 5).group(2, 2, ('a', 'b', 'c')) ) } @@ -1852,43 +1851,43 @@ class TupleTests { ) = tupler(mapper(range())) // group Unit - assertEquals( (), () group (2,1) ) + assertEquals((), ().group(2,1)) // partition a Tuple of 4 items into 2 (4/2) tuples of 2 items assertEquals( ((0, 1), (2, 3)), - range(0, 4) group(2, 2) + range(0, 4).group(2, 2) ) // partition a Tuple of 5 items into 2 (5/2) tuples of 2 items // the last item does not make a complete partition and is dropped. assertEquals( ((0, 1), (2, 3)), - range(0, 5) group(2, 2) + range(0, 5).group(2, 2) ) // uses the step to select the starting point for each partition assertEquals( ((0, 1), (4, 5)), - range(0, 6) group(2, 4) + range(0, 6).group(2, 4) ) // if the step is smaller than the partition size, items will be reused assertEquals( ((0, 1), (1, 2), (2, 3)), - range(0, 4) group(2, 1) + range(0, 4).group(2, 1) ) // when there are not enough items to fill the last partition, a pad can be supplied. assertEquals( ((0, 1), (2, 3), (4, 'a')), - range(0, 5) group(2, 2, Tuple1('a')) + range(0, 5).group(2, 2, Tuple1('a')) ) // but only as many pad elements are used as necessary to fill the final partition. assertEquals( ((0, 1), (2, 3), (4, 'a')), - range(0, 5) group(2, 2, ('a', 'b', 'c')) + range(0, 5).group(2, 2, ('a', 'b', 'c')) ) } diff --git a/core/shared/src/test/scala/shapeless/typeoperators.scala b/core/shared/src/test/scala/shapeless/typeoperators.scala index 23c7f0bd6..5fb5d2473 100644 --- a/core/shared/src/test/scala/shapeless/typeoperators.scala +++ b/core/shared/src/test/scala/shapeless/typeoperators.scala @@ -16,12 +16,11 @@ package shapeless -import scala.util.Try - -import org.junit.Test import org.junit.Assert._ - -import newtype._, tag._, test._, testutil._ +import org.junit.Test +import shapeless.newtype._ +import shapeless.tag._ +import shapeless.test._ class TypeOperatorTests { import TypeOperatorTests._ diff --git a/project/Boilerplate.scala b/project/Boilerplate.scala index 5a4253321..2407697f5 100644 --- a/project/Boilerplate.scala +++ b/project/Boilerplate.scala @@ -395,10 +395,10 @@ object Boilerplate { - def build = new Poly$arity { - val functions = self.functions - - - implicit def allCases[${`A..N`}, Out](implicit tL: Function${arity}TypeAt[${`A..N`}, Out, HL]) = { - - val func: (${`A..N`}) => Out = tL(functions) - - at(func) - - } + - implicit def allCases[${`A..N`}, Out]( + - implicit tL: Function${arity}TypeAt[${`A..N`}, Out, HL] + - ): this.Case.Aux[${`A..N`}, Out] = + - this.at(tL(functions)) - } - } - diff --git a/project/build.properties b/project/build.properties index 563a014da..04267b14a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.7.2 +sbt.version=1.9.9 diff --git a/project/plugins.sbt b/project/plugins.sbt index aeee62e22..c15c355b7 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,13 +1,13 @@ scalacOptions += "-deprecation" -libraryDependencies += "org.slf4j" % "slf4j-nop" % "2.0.3" +libraryDependencies += "org.slf4j" % "slf4j-nop" % "2.0.13" -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3") addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.6") -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") +addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0") addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") -addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.10.1") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") +addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2")