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

[WIP] move to Scala 2.13.0-RC1 (drop -M5) #2783

Closed
wants to merge 1 commit into from
Closed
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jdk:

scala_version_211: &scala_version_211 2.11.12
scala_version_212: &scala_version_212 2.12.7
scala_version_213: &scala_version_213 2.13.0-M5
scala_version_213: &scala_version_213 2.13.0-RC1

before_install:
- export PATH=${PATH}:./vendor/bundle
Expand Down
17 changes: 8 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ lazy val catsSettings = Seq(
"bintray/non".at("http://dl.bintray.com/non/maven")
),
libraryDependencies ++= Seq(
"org.typelevel" %%% "machinist" % "0.6.6",
compilerPlugin("org.spire-math" %% "kind-projector" % "0.9.9")
"org.typelevel" %%% "machinist" % "0.6.7",
compilerPlugin("org.typelevel" %% "kind-projector" % "0.10.0")
) ++ macroDependencies(scalaVersion.value),
) ++ commonSettings ++ publishSettings ++ scoverageSettings ++ simulacrumSettings

lazy val simulacrumSettings = Seq(
libraryDependencies += "com.github.mpilquist" %%% "simulacrum" % "0.15.0" % Provided,
libraryDependencies += "com.github.mpilquist" %%% "simulacrum" % "0.16.0" % Provided,
pomPostProcess := { (node: xml.Node) =>
new RuleTransformer(new RewriteRule {
override def transform(node: xml.Node): Seq[xml.Node] = node match {
Expand Down Expand Up @@ -153,12 +153,11 @@ lazy val includeGeneratedSrc: Setting[_] = {

val catalystsVersion = "0.8"

def scalatestVersion(scalaVersion: String): String =
if (priorTo2_13(scalaVersion)) "3.0.5" else "3.0.6-SNAP5"
val scalatestVersion = "3.0.8-RC2"

val scalaCheckVersion = "1.14.0"

val disciplineVersion = "0.10.0"
val disciplineVersion = "0.11.1"

lazy val disciplineDependencies = Seq(
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion,
Expand All @@ -168,7 +167,7 @@ lazy val disciplineDependencies = Seq(
lazy val testingDependencies = Seq(
libraryDependencies += "org.typelevel" %%% "catalysts-platform" % catalystsVersion,
libraryDependencies += "org.typelevel" %%% "catalysts-macros" % catalystsVersion % "test",
libraryDependencies += "org.scalatest" %%% "scalatest" % scalatestVersion(scalaVersion.value) % "test"
libraryDependencies += "org.scalatest" %%% "scalatest" % scalatestVersion % "test"
)

lazy val docsMappingsAPIDir = settingKey[String]("Name of subdirectory in site target directory for api docs")
Expand Down Expand Up @@ -563,7 +562,7 @@ lazy val testkit = crossProject(JSPlatform, JVMPlatform)
.settings(moduleName := "cats-testkit")
.settings(catsSettings)
.settings(disciplineDependencies)
.settings(libraryDependencies += "org.scalatest" %%% "scalatest" % scalatestVersion(scalaVersion.value))
.settings(libraryDependencies += "org.scalatest" %%% "scalatest" % scalatestVersion)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)

Expand Down Expand Up @@ -640,7 +639,7 @@ lazy val binCompatTest = project
else //We are not testing BC on Scala 2.13 yet.
"org.typelevel" %% "cats-core" % version.value % Provided
},
"org.scalatest" %%% "scalatest" % scalatestVersion(scalaVersion.value) % Test
"org.scalatest" %%% "scalatest" % scalatestVersion % Test
)
)
.dependsOn(core.jvm % Test)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/ApplicativeError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ trait ApplicativeError[F[_], E] extends Applicative[F] {
* `F[A]` values.
*/
def recover[A](fa: F[A])(pf: PartialFunction[E, A]): F[A] =
handleErrorWith(fa)(e => (pf.andThen(pure)).applyOrElse(e, raiseError))
handleErrorWith(fa)(e => (pf.andThen(pure _)).applyOrElse(e, raiseError _))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may i ask why those underscores are needed now? What have changed to make them required?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's scala/scala#7263


/**
* Recover from certain errors by mapping them to an `F[A]` value.
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/scala/cats/data/WriterT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ sealed private[data] trait WriterTFlatMap1[F[_], L] extends WriterTApply[F, L] w
implicit override def F0: FlatMap[F]
implicit def L0: Monoid[L]

override def ap[A, B](f: WriterT[F, L, A => B])(fa: WriterT[F, L, A]): WriterT[F, L, B] =
super[WriterTApply].ap(f)(fa)

def flatMap[A, B](fa: WriterT[F, L, A])(f: A => WriterT[F, L, B]): WriterT[F, L, B] =
fa.flatMap(f)

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/syntax/monadError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class MonadErrorOps[F[_], E, A](private val fa: F[A]) extends AnyVal {
*/
def reject(pf: PartialFunction[A, E])(implicit F: MonadError[F, E]): F[A] =
F.flatMap(fa) { a =>
pf.andThen(F.raiseError[A]).applyOrElse(a, (_: A) => fa)
pf.andThen(F.raiseError[A] _).applyOrElse(a, (_: A) => fa)
}

def adaptError(pf: PartialFunction[E, E])(implicit F: MonadError[F, E]): F[A] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import scala.collection.mutable

abstract private[kernel] class WrappedMutableMapBase[K, V](m: mutable.Map[K, V]) extends Map[K, V] {
def updated[V2 >: V](key: K, value: V2): Map[K, V2] = m.toMap + ((key, value))
def remove(key: K): Map[K, V] = m.toMap - key
def removed(key: K): Map[K, V] = m.toMap - key
}
2 changes: 1 addition & 1 deletion laws/src/main/scala/cats/laws/ApplicativeErrorLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ trait ApplicativeErrorLaws[F[_], E] extends ApplicativeLaws[F] {
F.handleError(fa)(f) <-> F.recover(fa) { case x => f(x) }

def recoverConsistentWithRecoverWith[A](fa: F[A], pf: PartialFunction[E, A]): IsEq[F[A]] =
F.recover(fa)(pf) <-> F.recoverWith(fa)(pf.andThen(F.pure))
F.recover(fa)(pf) <-> F.recoverWith(fa)(pf.andThen(F.pure _))

def attemptConsistentWithAttemptT[A](fa: F[A]): IsEq[EitherT[F, E, A]] =
EitherT(F.attempt(fa)) <-> F.attemptT(fa)
Expand Down
6 changes: 1 addition & 5 deletions tests/src/test/scala/cats/tests/TrySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ class TrySuite extends CatsSuite {
checkAll("Try[Int]", CoflatMapTests[Try].coflatMap[Int, Int, Int])
checkAll("CoflatMap[Try]", SerializableTests.serializable(CoflatMap[Try]))

//temporarily disable this test due to scala.util.Failure regression https://github.com/scala/bug/issues/11242
if (BuildInfo.scalaVersion != "2.13.0-M5") {
checkAll("Try with Throwable", MonadErrorTests[Try, Throwable].monadError[Int, Int, Int])
}

checkAll("Try with Throwable", MonadErrorTests[Try, Throwable].monadError[Int, Int, Int])
checkAll("MonadError[Try, Throwable]", SerializableTests.serializable(MonadError[Try, Throwable]))

checkAll("Try[Int] with Option", TraverseTests[Try].traverse[Int, Int, Int, Int, Option, Option])
Expand Down