From da8d92939399b059f24d7be0e5f75406432cf99a Mon Sep 17 00:00:00 2001 From: Alpha <666504+alphaho@users.noreply.github.com> Date: Wed, 2 Aug 2023 22:51:17 +0800 Subject: [PATCH] upgrade to Scala 3 to 3.3 --- .github/workflows/ci.yml | 2 +- project/BuildHelper.scala | 2 +- .../shared/src/main/scala-3/zio/schema/Derive.scala | 4 +++- .../shared/src/main/scala-3/zio/schema/DeriveSchema.scala | 6 ++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52ffe29c1..4d0c0ab28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: fail-fast: false matrix: java: ['adopt@1.8', 'adopt@1.11'] - scala: ['2.12.17', '2.13.8', '3.2.1'] + scala: ['2.12.17', '2.13.8', '3.3.0'] steps: - uses: actions/checkout@v3.0.0 with: diff --git a/project/BuildHelper.scala b/project/BuildHelper.scala index 1448a489f..f2a0331aa 100644 --- a/project/BuildHelper.scala +++ b/project/BuildHelper.scala @@ -23,7 +23,7 @@ object BuildHelper { val Scala212: String = versions("2.12") val Scala213: String = versions("2.13") - val Scala3: String = versions("3.2") //versions.getOrElse("3.0", versions("3.1")) + val Scala3: String = versions("3.3") //versions.getOrElse("3.0", versions("3.1")) val zioVersion = "2.0.10" val zioJsonVersion = "0.5.0" diff --git a/zio-schema-derivation/shared/src/main/scala-3/zio/schema/Derive.scala b/zio-schema-derivation/shared/src/main/scala-3/zio/schema/Derive.scala index c33c8cdcf..b4c342f21 100644 --- a/zio-schema-derivation/shared/src/main/scala-3/zio/schema/Derive.scala +++ b/zio-schema-derivation/shared/src/main/scala-3/zio/schema/Derive.scala @@ -14,7 +14,9 @@ object Derive { DeriveInstance().deriveInstance[F, A](deriver, schema, top = true) } -private case class DeriveInstance()(using val ctx: Quotes) extends ReflectionUtils(ctx) { +private case class DeriveInstance()(using val ctx: Quotes) { + val reflectionUtils = ReflectionUtils(ctx) + import reflectionUtils.{MirrorType, Mirror, summonOptional} import ctx.reflect._ case class Frame(ref: Term, tpe: TypeRepr) diff --git a/zio-schema-derivation/shared/src/main/scala-3/zio/schema/DeriveSchema.scala b/zio-schema-derivation/shared/src/main/scala-3/zio/schema/DeriveSchema.scala index 4e67fd317..a7fac9e43 100644 --- a/zio-schema-derivation/shared/src/main/scala-3/zio/schema/DeriveSchema.scala +++ b/zio-schema-derivation/shared/src/main/scala-3/zio/schema/DeriveSchema.scala @@ -18,9 +18,11 @@ object DeriveSchema { DeriveSchema().deriveSchema[T](top = true) } -private case class DeriveSchema()(using val ctx: Quotes) extends ReflectionUtils(ctx) { +private case class DeriveSchema()(using val ctx: Quotes) { + val reflectionUtils = ReflectionUtils(ctx) + import reflectionUtils.{MirrorType, Mirror} import ctx.reflect._ - + case class Frame(ref: Term, tpe: TypeRepr) case class Stack(frames: List[Frame]) { def find(tpe: TypeRepr): Option[Term] = frames.find(_.tpe =:= tpe).map(_.ref)