Skip to content

Commit

Permalink
Fix max-inline due to nested derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones committed Jul 18, 2022
1 parent 4cdfeb7 commit 4228876
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions avro/src/test/scala/magnolify/avro/test/AvroTypeSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down

0 comments on commit 4228876

Please sign in to comment.