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

More Dotty compat stuff in tests #3255

Merged
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
2 changes: 1 addition & 1 deletion tests/src/test/scala/cats/tests/AsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AsSuite extends CatsSuite {
fa.foldLeft(Map.empty[A, B])(subst(_ + _))
}

implicit def arbAs[A, B](implicit ev: A <~< B) = Arbitrary(Gen.const(ev))
implicit def arbAs[A, B](implicit ev: A <~< B): Arbitrary[A <~< B] = Arbitrary(Gen.const(ev))
implicit def eq[A, B]: Eq[As[A, B]] = Eq.fromUniversalEquals

test("narrow an input of a function2") {
Expand Down
4 changes: 2 additions & 2 deletions tests/src/test/scala/cats/tests/EvalSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ class EvalSuite extends CatsSuite {
Arbitrary(
Gen.oneOf(arbitrary[A => A].map(OMap(_)),
arbitrary[A => Eval[A]].map(OFlatMap(_)),
Gen.const(OMemoize[A]),
Gen.const(ODefer[A]))
Gen.const(OMemoize[A]()),
Gen.const(ODefer[A]()))
)

def build[A](leaf: () => Eval[A], os: Vector[O[A]]): DeepEval[A] = {
Expand Down
2 changes: 1 addition & 1 deletion tests/src/test/scala/cats/tests/FoldableSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ class FoldableEitherKSuite extends FoldableSuite[EitherK[Option, Option, *]]("ei
def iterator[T](eitherK: EitherK[Option, Option, T]) = eitherK.run.bimap(_.iterator, _.iterator).merge
}

class FoldableIorSuite extends FoldableSuite[Int Ior *]("ior") {
class FoldableIorSuite extends FoldableSuite[Ior[Int, *]]("ior") {
def iterator[T](ior: Int Ior T) =
ior.fold(_ => None.iterator, b => Some(b).iterator, (_, b) => Some(b).iterator)
}
Expand Down
14 changes: 7 additions & 7 deletions tests/src/test/scala/cats/tests/IorSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ class IorSuite extends CatsSuite {
implicit val iso: Isomorphisms[Ior[String, *]] = Isomorphisms.invariant[Ior[String, *]]

checkAll("Ior[String, Int]", SemigroupalTests[Ior[String, *]].semigroupal[Int, Int, Int])
checkAll("Semigroupal[String Ior *]]", SerializableTests.serializable(Semigroupal[String Ior *]))
checkAll("Semigroupal[Ior[String, *]]", SerializableTests.serializable(Semigroupal[Ior[String, *]]))

implicit val eq0: Eq[EitherT[Ior[String, *], String, Int]] = EitherT.catsDataEqForEitherT[Ior[String, *], String, Int]

checkAll("Ior[String, Int]", MonadErrorTests[String Ior *, String].monadError[Int, Int, Int])
checkAll("MonadError[String Ior *]", SerializableTests.serializable(MonadError[String Ior *, String]))
checkAll("Ior[String, Int]", MonadErrorTests[Ior[String, *], String].monadError[Int, Int, Int])
checkAll("MonadError[SIor[String, *]]", SerializableTests.serializable(MonadError[Ior[String, *], String]))

checkAll("Ior[String, Int] with Option", TraverseTests[String Ior *].traverse[Int, Int, Int, Int, Option, Option])
checkAll("Traverse[String Ior *]", SerializableTests.serializable(Traverse[String Ior *]))
checkAll("* Ior *", BifunctorTests[Ior].bifunctor[Int, Int, Int, String, String, String])
checkAll("Ior[String, Int] with Option", TraverseTests[Ior[String, *]].traverse[Int, Int, Int, Int, Option, Option])
checkAll("Traverse[Ior[String, *]]", SerializableTests.serializable(Traverse[Ior[String, *]]))
checkAll("Ior[*, *]", BifunctorTests[Ior].bifunctor[Int, Int, Int, String, String, String])

checkAll("Ior[*, *]", BitraverseTests[Ior].bitraverse[Option, Int, Int, Int, String, String, String])
checkAll("BitraverseTests Ior[*, *]", BitraverseTests[Ior].bitraverse[Option, Int, Int, Int, String, String, String])
checkAll("Bitraverse[Ior]", SerializableTests.serializable(Bitraverse[Ior]))

checkAll("Semigroup[Ior[A: Semigroup, B: Semigroup]]", SemigroupTests[Ior[List[Int], List[Int]]].semigroup)
Expand Down
2 changes: 1 addition & 1 deletion tests/src/test/scala/cats/tests/KleisliSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class KleisliSuite extends CatsSuite {
SerializableTests.serializable(Contravariant[Kleisli[Option, *, Int]]))

test("Functor[Kleisli[F, Int, *]] is not ambiguous when an ApplicativeError and a FlatMap are in scope for F") {
def shouldCompile1[F[_]: ApplicativeError[*[_], E]: FlatMap, E]: Functor[Kleisli[F, Int, *]] =
def shouldCompile1[F[_], E](implicit F: ApplicativeError[F, E], FM: FlatMap[F]): Functor[Kleisli[F, Int, *]] =
Functor[Kleisli[F, Int, *]]
}

Expand Down
6 changes: 3 additions & 3 deletions tests/src/test/scala/cats/tests/NonEmptyVectorSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,17 @@ class NonEmptyVectorSuite extends CatsSuite {
// A bug in scala 2.10 allows private constructors to be accessed.
// We should still ensure that on scala 2.11 and up we cannot construct the
// object directly. see: https://issues.scala-lang.org/browse/SI-6601
"val bad: NonEmptyVector[Int] = new NonEmptyVector(Vector(1))" shouldNot compile
assertDoesNotCompile("val bad: NonEmptyVector[Int] = new NonEmptyVector(Vector(1))")
}
}
}

test("Cannot create a new NonEmptyVector[Int] from apply with a Vector[Int]") {
"val bad: NonEmptyVector[Int] = NonEmptyVector(Vector(1))" shouldNot compile
assertDoesNotCompile("val bad: NonEmptyVector[Int] = NonEmptyVector(Vector(1))")
}

test("Cannot create a new NonEmptyVector[Int] from apply with a an empty Vector") {
"val bad: NonEmptyVector[Int] = NonEmptyVector(Vector.empty[Int])" shouldNot compile
assertDoesNotCompile("val bad: NonEmptyVector[Int] = NonEmptyVector(Vector.empty[Int])")
}

test("NonEmptyVector#distinct is consistent with Vector#distinct") {
Expand Down