Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
cchantep committed Mar 11, 2022
1 parent bd7cec4 commit 61a100e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
strategy:
matrix:
jdk: [ 11, 8 ]
scala: [ 2.12.15, 2.13.8, 3.1.2-RC1-bin-20211222-c94b333-NIGHTLY ] # Should be sync with Mergify conditions (.mergify.yml)
scala: [ 2.12.15, 2.13.8, 3.1.2-RC2 ] # Should be sync with Mergify conditions (.mergify.yml)
name: Check / Tests (Scala ${{ matrix.scala }} & JDK ${{ matrix.jdk }})
steps:
- name: Checkout
Expand Down
4 changes: 1 addition & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import com.typesafe.tools.mima.core._
import sbtcrossproject.CrossPlugin.autoImport.crossProject
import sbtcrossproject.CrossType

ThisBuild / scalafmtOnCompile := true

resolvers ++= DefaultOptions.resolvers(snapshot = true)

val isScala3 = Def.setting {
Expand All @@ -20,7 +18,7 @@ val isScala3 = Def.setting {

def specs2(scalaVersion: String) =
Seq("core", "junit").map { n =>
("org.specs2" %% s"specs2-$n" % "4.13.2").cross(CrossVersion.for3Use2_13) % Test
("org.specs2" %% s"specs2-$n" % "4.14.1").cross(CrossVersion.for3Use2_13) % Test
}

val jacksonVersion = "2.11.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The macros work for classes and traits meeting the following requirements.
- The return types of the `unapply` must match the argument types of the `apply` method.
- The parameter names of the `apply` method must be the same as the property names desired in the JSON.

**Class in Scala 3.x:**
**Class in Scala 3.1.x:** (+3.1.2-RC2)

- It must be provided a [`Conversion`](https://dotty.epfl.ch/api/scala/Conversion.html) to a `_ <: Product`.
- It must be provided a valid [`ProductOf`](https://dotty.epfl.ch/api/scala/deriving/Mirror$.html#ProductOf-0).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ private[json] trait ImplicitResolver[A] {
}

s"// Resolve given ${prettyType(
TypeRepr.of(using tc)
)} for ${prettyType(ntpe)} as ${prettyType(
neededGivenType
)} (self? ${selfRef}) = ${show.mkString}"
TypeRepr.of(using tc)
)} for ${prettyType(ntpe)} as ${prettyType(
neededGivenType
)} (self? ${selfRef}) = ${show.mkString}"
}

neededGiven.map(_ -> selfRef)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ object JsMacroImpl { // TODO: debug
def anyValFormat[A <: AnyVal: Type](using
Quotes
): Expr[Format[A]] = '{
// format: off
Format[A](${ anyValReads[A] }, ${ anyValWrites[A] })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ private[json] trait MacroHelpers { self: OptionSupport =>

def unapply(tpr: TypeRepr): Option[TypeRepr] = {
if (self.isOptionalType(tpr)) {
tpr.typeArgs.headOption
// TODO: tpr.typeArgs.headOption

tpr match {
case AppliedType(_, args) => args.headOption
case _ => None
}
} else None
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ package play.api.libs.json
import org.scalatest.matchers.must.Matchers
import org.scalatest.wordspec.AnyWordSpec

import org.scalacheck.Gen

class MacroScala2Spec extends AnyWordSpec with Matchers with org.scalatestplus.scalacheck.ScalaCheckPropertyChecks {
import MacroScala2Spec._

Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ object Dependencies {
// - Mergify conditions (.mergify.yml)
val Scala212 = "2.12.15"
val Scala213 = "2.13.8"
val Scala3 = "3.1.2-RC1-bin-20211222-c94b333-NIGHTLY"
val Scala3 = "3.1.2-RC2"
}

0 comments on commit 61a100e

Please sign in to comment.