Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Scala 3.1.2-RC3 and fix outstanding issues #455

Merged
merged 1 commit into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.15, 2.13.8, 3.1.1]
scala: [2.12.15, 2.13.8, 3.1.2-RC3]
java: [temurin@8]
project: [rootJS, rootJVM]
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.1.1]
scala: [3.1.2-RC3]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -168,22 +168,22 @@ jobs:
tar xf targets.tar
rm targets.tar

- name: Download target directories (3.1.1, rootJS)
- name: Download target directories (3.1.2-RC3, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-RC3-rootJS

- name: Inflate target directories (3.1.1, rootJS)
- name: Inflate target directories (3.1.2-RC3, rootJS)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (3.1.1, rootJVM)
- name: Download target directories (3.1.2-RC3, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-RC3-rootJVM

- name: Inflate target directories (3.1.1, rootJVM)
- name: Inflate target directories (3.1.2-RC3, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sbt._

val scala212 = "2.12.15"
val scala213 = "2.13.8"
val scala3 = "3.1.1"
val scala3 = "3.1.2-RC3"

ThisBuild / crossScalaVersions := Seq(scala212, scala213, scala3)
ThisBuild / scalaVersion := scala3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object DerivedCommutativeMonoid:
import DerivedCommutativeMonoid.given
summonInline[DerivedCommutativeMonoid[A]].instance

given [A](using inst: K0.ProductInstances[Or, A]): DerivedCommutativeMonoid[A] =
given [A](using inst: => K0.ProductInstances[Or, A]): DerivedCommutativeMonoid[A] =
given K0.ProductInstances[CommutativeMonoid, A] = inst.unify
new Product[CommutativeMonoid, A] {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object DerivedCommutativeSemigroup:
import DerivedCommutativeSemigroup.given
summonInline[DerivedCommutativeSemigroup[A]].instance

given [A](using inst: K0.ProductInstances[Or, A]): DerivedCommutativeSemigroup[A] =
given [A](using inst: => K0.ProductInstances[Or, A]): DerivedCommutativeSemigroup[A] =
given K0.ProductInstances[CommutativeSemigroup, A] = inst.unify
new Product[CommutativeSemigroup, A] {}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala-3/cats/derived/DerivedEq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ object DerivedEq:
import DerivedEq.given
summonInline[DerivedEq[A]].instance

given [A](using inst: K0.ProductInstances[Or, A]): DerivedEq[A] =
given product[A](using inst: => K0.ProductInstances[Or, A]): DerivedEq[A] =
given K0.ProductInstances[Eq, A] = inst.unify
new Product[Eq, A] {}

given [A](using inst: => K0.CoproductInstances[Or, A]): DerivedEq[A] =
given coproduct[A](using inst: => K0.CoproductInstances[Or, A]): DerivedEq[A] =
given K0.CoproductInstances[Eq, A] = inst.unify
new Coproduct[Eq, A] {}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala-3/cats/derived/DerivedHash.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ object DerivedHash:
import DerivedHash.given
summonInline[DerivedHash[A]].instance

given [A <: scala.Product](using inst: K0.ProductInstances[Or, A]): DerivedHash[A] =
given product[A <: scala.Product](using inst: => K0.ProductInstances[Or, A]): DerivedHash[A] =
given K0.ProductInstances[Hash, A] = inst.unify
new Product[Hash, A] {}

given [A](using inst: => K0.CoproductInstances[Or, A]): DerivedHash[A] =
given coproduct[A](using inst: => K0.CoproductInstances[Or, A]): DerivedHash[A] =
given K0.CoproductInstances[Hash, A] = inst.unify
new Coproduct[Hash, A] {}

Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala-3/cats/derived/DerivedMonoid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ object DerivedMonoid:
import DerivedMonoid.given
summonInline[DerivedMonoid[A]].instance

given [A](using inst: K0.ProductInstances[Or, A]): DerivedMonoid[A] =
given [A](using inst: => K0.ProductInstances[Or, A]): DerivedMonoid[A] =
given K0.ProductInstances[Monoid, A] = inst.unify
new Product[Monoid, A] {}

trait Product[F[x] <: Monoid[x], A](using inst: K0.ProductInstances[F, A])
extends DerivedSemigroup.Product[F, A],
Monoid[A]:
final override val empty: A = inst.construct([A] => (F: F[A]) => F.empty)
final override lazy val empty: A =
inst.construct([A] => (F: F[A]) => F.empty)
2 changes: 1 addition & 1 deletion core/src/main/scala-3/cats/derived/DerivedSemigroup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object DerivedSemigroup:
import DerivedSemigroup.given
summonInline[DerivedSemigroup[A]].instance

given [A](using inst: K0.ProductInstances[Or, A]): DerivedSemigroup[A] =
given [A](using inst: => K0.ProductInstances[Or, A]): DerivedSemigroup[A] =
given K0.ProductInstances[Semigroup, A] = inst.unify
new Product[Semigroup, A] {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class CommutativeMonoidSuite extends KittensSuite:

inline def testCommutativeMonoid(inline context: String): Unit =
checkAll(s"$context.CommutativeMonoid[Foo]", commutativeMonoidTests[CommutativeFoo].commutativeMonoid)
// FIXME: Doesn't work
// checkAll(s"$context.CommutativeMonoid[Recursive]", commutativeMonoidTests[Recursive].commutativeMonoid)
checkAll(s"$context.CommutativeMonoid[Recursive]", commutativeMonoidTests[Recursive].commutativeMonoid)
checkAll(s"$context.CommutativeMonoid[Box[Mul]]", commutativeMonoidTests[Box[Mul]].commutativeMonoid)
checkAll(
s"$context.CommutativeMonoid is Serializable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class CommutativeSemigroupSuite extends KittensSuite:
s"$context.CommutativeSemigroup[CommutativeFoo]",
commutativeSemigroupTests[CommutativeFoo].commutativeSemigroup
)
// FIXME: Doesn't work
// checkAll(s"$context.CommutativeSemigroup[Recursive]", commutativeSemigroupTests[Recursive].commutativeSemigroup)
checkAll(s"$context.CommutativeSemigroup[Recursive]", commutativeSemigroupTests[Recursive].commutativeSemigroup)
checkAll(s"$context.CommutativeSemigroup[Box[Mul]]", commutativeSemigroupTests[Box[Mul]].commutativeSemigroup)
checkAll(
s"$context.CommutativeSemigroup is Serializable",
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/scala-3/cats/derived/EqSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class EqSuite extends KittensSuite.WithoutEq:
checkAll(s"$context.Eq[Outer]", eqTests[Outer].eqv)
checkAll(s"$context.Eq[Interleaved[Int]]", eqTests[Interleaved[Int]].eqv)
checkAll(s"$context.Eq[Tree[Int]]", eqTests[Tree[Int]].eqv)
// FIXME: Doesn't work for recursive case classes.
// checkAll(s"$context.Eq[Recursive]", eqTests[Recursive].eqv)
checkAll(s"$context.Eq[Recursive]", eqTests[Recursive].eqv)
checkAll(s"$context.Eq is Serializable", SerializableTests.serializable(summonInline[Eq[Foo]]))

locally {
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/scala-3/cats/derived/FunctorSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class FunctorSuite extends KittensSuite:
checkAll(s"$context.Functor[GenericAdt]", functorTests[GenericAdt].functor[Int, String, Long])
checkAll(s"$context.Functor[OptList]", functorTests[OptList].functor[Int, String, Long])
checkAll(s"$context.Functor[ListSnoc]", functorTests[ListSnoc].functor[Int, String, Long])
// FIXME: Testing `functorTests[AndChar].functor[Int, String, Long]` causes a ClassCastException
checkAll(s"$context.Functor[AndChar]", functorTests[AndChar].functor[Int, String, Int])
checkAll(s"$context.Functor[AndChar]", functorTests[AndChar].functor[Int, String, Long])
checkAll(s"$context.Functor[Interleaved]", functorTests[Interleaved].functor[Int, String, Long])
checkAll(s"$context.Functor[NestedPred]", functorTests[NestedPred].functor[Boolean, Int, Boolean])
checkAll(s"$context.Functor is Serializable", SerializableTests.serializable(summonInline[Functor[Tree]]))
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/scala-3/cats/derived/HashSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class HashSuite extends KittensSuite:
// FIXME: typelevel/cats#2878
// checkAll(s"$context.Hash[Interleaved[Int]]", hashTests[Interleaved[Int]].hash)
checkAll(s"$context.Hash[Tree[Int]]", hashTests[Tree[Int]].hash)
// FIXME: Doesn't work for recursive case classes.
// checkAll(s"$context.Hash[Recursive]", hashTests[Recursive].hash)
checkAll(s"$context.Hash[Recursive]", hashTests[Recursive].hash)
checkAll(s"$context.Hash is Serializable", SerializableTests.serializable(summonInline[Hash[Inner]]))

locally {
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/scala-3/cats/derived/MonoidSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class MonoidSuite extends KittensSuite:
checkAll(s"$context.Monoid[Foo]", monoidTests[Foo].monoid)
checkAll(s"$context.Monoid[Interleaved[Int]]", monoidTests[Interleaved[Int]].monoid)
checkAll(s"$context.Monoid[Box[Mul]]", monoidTests[Box[Mul]].monoid)
// FIXME: Doesn't work
// checkAll(s"$context.Monoid[Recursive]", monoidTests[Recursive].monoid)
checkAll(s"$context.Monoid[Recursive]", monoidTests[Recursive].monoid)
checkAll(s"$context.Monoid is Serializable", SerializableTests.serializable(summonInline[Monoid[Foo]]))
test(s"$context.Monoid respects existing instances") {
val box = summonInline[Monoid[Box[Mul]]]
Expand Down
32 changes: 10 additions & 22 deletions core/src/test/scala-3/cats/derived/NonEmptyTraverseSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@ class NonEmptyTraverseSuite extends KittensSuite:
s"$context.NonEmptyTraverse[Tree]",
nonEmptyTraverseTests[Tree].nonEmptyTraverse[Option, Int, Int, Int, Int, Option, Option]
)
// FIXME: Those don't work
// checkAll(
// s"$context.NonEmptyTraverse[NelSCons]",
// nonEmptyTraverseTests[NelSCons].nonEmptyTraverse[Option, Int, Int, Int, Int, Option, Option]
// )
// checkAll(
// s"$context.NonEmptyTraverse[NelAndOne]",
// nonEmptyTraverseTests[NelAndOne].nonEmptyTraverse[Option, Int, Int, Int, Int, Option, Option]
// )
checkAll(
s"$context.NonEmptyTraverse[NelSCons]",
nonEmptyTraverseTests[NelSCons].nonEmptyTraverse[Option, Int, Int, Int, Int, Option, Option]
)
checkAll(
s"$context.NonEmptyTraverse[NelAndOne]",
nonEmptyTraverseTests[NelAndOne].nonEmptyTraverse[Option, Int, Int, Int, Int, Option, Option]
)
checkAll(
s"$context.NonEmptyTraverse[VecAndNel]",
nonEmptyTraverseTests[VecAndNel].nonEmptyTraverse[Option, Int, Int, Int, Int, Option, Option]
Expand Down Expand Up @@ -79,19 +78,8 @@ object NonEmptyTraverseSuite:
import TestDefns.*

type NelSCons[A] = NonEmptyList[SCons[A]]
type NelAndOne[A] = NonEmptyList[OneAnd[List, A]]

// FIXME: Doesn't work if we define `ListAndNel` as a type alias
final case class VecAndNel[A](vec: Vector[A], nel: NonEmptyList[A])
object VecAndNel:
given [A: Eq]: Eq[VecAndNel[A]] =
(x, y) => x.vec === y.vec && x.nel === y.nel

given [A: Arbitrary]: Arbitrary[VecAndNel[A]] =
Arbitrary(for
vec <- Arbitrary.arbitrary[Vector[A]]
nel <- Arbitrary.arbitrary[NonEmptyList[A]]
yield VecAndNel(vec, nel))
type NelAndOne[A] = NonEmptyList[OneAnd[Vector, A]]
type VecAndNel[A] = (Vector[A], NonEmptyList[A])

object semiInstances:
given NonEmptyTraverse[ICons] = semiauto.nonEmptyTraverse
Expand Down
20 changes: 4 additions & 16 deletions core/src/test/scala-3/cats/derived/ReducibleSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ class ReducibleSuite extends KittensSuite:
inline def testReducible(context: String): Unit =
checkAll(s"$context.Reducible[ICons]", reducibleTests[ICons].reducible[Option, Int, Long])
checkAll(s"$context.Reducible[Tree]", reducibleTests[Tree].reducible[Option, Int, Long])
// FIXME: Those don't work
// checkAll(s"$context.Reducible[NelSCons]", reducibleTests[NelSCons].reducible[Option, Int, Long])
// checkAll(s"$context.Reducible[NelAndOne]", reducibleTests[NelAndOne].reducible[Option, Int, Long])
checkAll(s"$context.Reducible[NelSCons]", reducibleTests[NelSCons].reducible[Option, Int, Long])
checkAll(s"$context.Reducible[NelAndOne]", reducibleTests[NelAndOne].reducible[Option, Int, Long])
checkAll(s"$context.Reducible[VecAndNel]", reducibleTests[VecAndNel].reducible[Option, Int, Long])
checkAll(s"$context.Reducible[Interleaved]", reducibleTests[Interleaved].reducible[Option, Int, Long])
checkAll(s"$context.Reducible[BoxZipper]", reducibleTests[BoxZipper].reducible[Option, Int, Long])
Expand All @@ -58,7 +57,8 @@ object ReducibleSuite:
import TestDefns.*

type NelSCons[A] = NonEmptyList[SCons[A]]
type NelAndOne[A] = NonEmptyList[OneAnd[List, A]]
type NelAndOne[A] = NonEmptyList[OneAnd[Vector, A]]
type VecAndNel[A] = (Vector[A], NonEmptyList[A])
type BoxZipper[A] = Box[Zipper[A]]

object semiInstances:
Expand All @@ -70,18 +70,6 @@ object ReducibleSuite:
given Reducible[Interleaved] = semiauto.reducible
given Reducible[BoxZipper] = semiauto.reducible

// FIXME: Doesn't work if we define `VecAndNel` as a type alias
final case class VecAndNel[A](vec: Vector[A], nel: NonEmptyList[A])
object VecAndNel:
given [A: Eq]: Eq[VecAndNel[A]] =
(x, y) => x.vec === y.vec && x.nel === y.nel

given [A: Arbitrary]: Arbitrary[VecAndNel[A]] =
Arbitrary(for
vec <- Arbitrary.arbitrary[Vector[A]]
nel <- Arbitrary.arbitrary[NonEmptyList[A]]
yield VecAndNel(vec, nel))

final case class Zipper[+A](left: List[A], focus: A, right: List[A])
object Zipper:
given [A: Eq]: Eq[Zipper[A]] =
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/scala-3/cats/derived/SemigroupSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class SemigroupSuite extends KittensSuite:
checkAll(s"$context.Semigroup[Foo]", semigroupTests[Foo].semigroup)
checkAll(s"$context.Semigroup[Interleaved[Int]]", semigroupTests[Interleaved[Int]].semigroup)
checkAll(s"$context.Semigroup[Box[Mul]]", semigroupTests[Box[Mul]].semigroup)
// FIXME: Doesn't work
// checkAll(s"$context.Semigroup[Recursive]", semigroupTests[Recursive].semigroup)
checkAll(s"$context.Semigroup[Recursive]", semigroupTests[Recursive].semigroup)
checkAll(s"$context.Semigroup is Serializable", SerializableTests.serializable(summonInline[Semigroup[Foo]]))
test(s"$context.Semigroup respects existing instances") {
val box = summonInline[Semigroup[Box[Mul]]]
Expand Down
9 changes: 1 addition & 8 deletions core/src/test/scala-3/cats/derived/TraverseSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,7 @@ object TraverseSuite:

type OptList[A] = Option[List[A]]
type ListSnoc[A] = List[Snoc[A]]

// FIXME: Doesn't work if we define `ListAndNel` as a type alias
case class AndChar[A](value: A, letter: Char)
object AndChar:
given [A: Eq]: Eq[AndChar[A]] =
Eq.by(ac => (ac.value, ac.letter))
given [A: Arbitrary]: Arbitrary[AndChar[A]] =
Arbitrary(Arbitrary.arbitrary[(A, Char)].map(apply[A].tupled))
type AndChar[A] = (A, Char)

object semiInstances:
given Traverse[IList] = semiauto.traverse
Expand Down