From ff9c41a94044ea1cb3ae444396082d8810ca7d1d Mon Sep 17 00:00:00 2001 From: Nabil Abdel-Hafeez <7283535+987Nabil@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:00:39 +0200 Subject: [PATCH] Use unroll plugin to fix bin compat issue --- build.sbt | 11 +++++++---- .../src/main/scala/zio/schema/codec/JsonCodec.scala | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 478857687..b46238075 100644 --- a/build.sbt +++ b/build.sbt @@ -4,6 +4,8 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ Global / onChangedBuildSource := ReloadOnSourceChanges +addCompilerPlugin("com.lihaoyi" %% "unroll-plugin" % "0.1.12") + inThisBuild( List( name := "zio-schema", @@ -149,10 +151,11 @@ lazy val zioSchema = crossProject(JSPlatform, JVMPlatform, NativePlatform) .settings(buildInfoSettings("zio.schema")) .settings( libraryDependencies ++= Seq( - "dev.zio" %%% "zio" % zioVersion, - "dev.zio" %%% "zio-streams" % zioVersion, - "dev.zio" %%% "zio-prelude" % zioPreludeVersion, - "dev.zio" %%% "zio-constraintless" % zioConstraintlessVersion + "dev.zio" %%% "zio" % zioVersion, + "dev.zio" %%% "zio-streams" % zioVersion, + "dev.zio" %%% "zio-prelude" % zioPreludeVersion, + "dev.zio" %%% "zio-constraintless" % zioConstraintlessVersion, + "com.lihaoyi" %% "unroll-annotation" % "0.1.12" ) ) .nativeSettings(Test / fork := false) diff --git a/zio-schema-json/shared/src/main/scala/zio/schema/codec/JsonCodec.scala b/zio-schema-json/shared/src/main/scala/zio/schema/codec/JsonCodec.scala index 19aa3fc78..bc7d55aad 100644 --- a/zio-schema-json/shared/src/main/scala/zio/schema/codec/JsonCodec.scala +++ b/zio-schema-json/shared/src/main/scala/zio/schema/codec/JsonCodec.scala @@ -3,7 +3,7 @@ package zio.schema.codec import java.nio.CharBuffer import java.nio.charset.StandardCharsets -import scala.annotation.{ switch, tailrec } +import scala.annotation.{ switch, tailrec, unroll } import scala.collection.immutable.ListMap import zio.json.JsonCodec._ @@ -28,7 +28,7 @@ object JsonCodec { final case class Config( ignoreEmptyCollections: Boolean, - treatStreamsAsArrays: Boolean = false, + @unroll treatStreamsAsArrays: Boolean = false, explicitNulls: Boolean = false )