From 42288762fd33839f30840035442fb6938e50028c Mon Sep 17 00:00:00 2001 From: Michel Davit Date: Thu, 30 Jun 2022 11:57:51 +0200 Subject: [PATCH] Fix max-inline due to nested derivation --- .../test/scala/magnolify/avro/test/AvroTypeSuite.scala | 10 +++++++--- build.sbt | 1 + .../scalacheck/test/ArbitraryDerivationSuite.scala | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/avro/src/test/scala/magnolify/avro/test/AvroTypeSuite.scala b/avro/src/test/scala/magnolify/avro/test/AvroTypeSuite.scala index 78297bc62..ea052fcfb 100644 --- a/avro/src/test/scala/magnolify/avro/test/AvroTypeSuite.scala +++ b/avro/src/test/scala/magnolify/avro/test/AvroTypeSuite.scala @@ -27,8 +27,7 @@ import com.fasterxml.jackson.core.JsonFactory import com.fasterxml.jackson.databind.{JsonNode, ObjectMapper} import magnolify.avro._ import magnolify.avro.logical._ -import magnolify.avro.semiauto.AvroFieldDerivation -import magnolify.shared.CaseMapper +import magnolify.shared.{CaseMapper, EnumType} import magnolify.test.Simple._ import magnolify.test._ import org.apache.avro.Schema @@ -112,6 +111,12 @@ class AvroTypeSuite implicit val arbCountryCode: Arbitrary[CountryCode] = Arbitrary( Gen.oneOf("US", "UK", "CA", "MX").map(CountryCode(_)) ) + + // Enum types would be derived several times if not stored + implicit val etJava: EnumType[JavaEnums.Color] = javaEnumType[JavaEnums.Color] + implicit val etScala: EnumType[ScalaEnums.Color.Type] = scalaEnumType[ScalaEnums.Color.Type] + implicit val etAdt: EnumType[ADT.Color] = autoDerivedEnumType[ADT.Color] + implicit val afUri: AvroField[URI] = AvroField.from[String](URI.create)(_.toString) implicit val afDuration: AvroField[Duration] = AvroField.from[Long](Duration.ofMillis)(_.toMillis) @@ -236,7 +241,6 @@ class AvroTypeSuite new AvroBigQueryImplicits { test("DefaultInner") { // val at = ensureSerializable(AvroType[DefaultInner]) - AvroFieldDerivation[DefaultInner] val at = AvroType[DefaultInner] assertEquals(at(new GenericRecordBuilder(at.schema).build()), DefaultInner()) val inner = DefaultInner( diff --git a/build.sbt b/build.sbt index b5102bc38..80da68d2f 100644 --- a/build.sbt +++ b/build.sbt @@ -63,6 +63,7 @@ ThisBuild / tpolecatDevModeOptions ~= { opts => val parallelism = math.min(java.lang.Runtime.getRuntime.availableProcessors(), 16) val extras = Set( ScalacOptions.privateOption("retain-trees", _ >= V3_0_0), + // allow some nested auto derivation new ScalacOption("-Xmax-inlines" :: "64" :: Nil, _ >= V3_0_0), ScalacOptions.warnOption("macros:after", version => version.isBetween(V2_13_0, V3_0_0)), ScalacOptions.privateWarnOption("macros:after", version => version.isBetween(V2_12_0, V2_13_0)), diff --git a/scalacheck/src/test/scala/magnolify/scalacheck/test/ArbitraryDerivationSuite.scala b/scalacheck/src/test/scala/magnolify/scalacheck/test/ArbitraryDerivationSuite.scala index bde069309..c8fe19bd1 100644 --- a/scalacheck/src/test/scala/magnolify/scalacheck/test/ArbitraryDerivationSuite.scala +++ b/scalacheck/src/test/scala/magnolify/scalacheck/test/ArbitraryDerivationSuite.scala @@ -17,7 +17,6 @@ package magnolify.scalacheck.test //import magnolify.scalacheck.Fallback -//import magnolify.scalacheck.semiauto.ArbitraryDerivation import magnolify.test.ADT._ import magnolify.test.Simple._ import magnolify.test._