Skip to content

Commit

Permalink
Fix scala3 warning
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones committed Jan 3, 2024
1 parent 5a8439f commit 27c1fb2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ val commonSettings = Seq(
"-Yretain-trees",
// tolerate some nested macro expansion
"-Xmax-inlines",
"64"
"64",
// silence warnings. dotty doesn't have unused-imports category nor origin support yet
"-Wconf:msg=unused import:s"
)
case Some((2, 13)) =>
Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ import magnolify.test.ADT.*
import magnolify.test.JavaEnums
import magnolify.test.Simple.*
import org.scalacheck.Cogen
import org.scalacheck.rng.Seed

import java.net.URI

object TestCogen {
// enum
implicit lazy val coJavaEnum: Cogen[JavaEnums.Color] = Cogen(_.ordinal().toLong)
implicit lazy val coScalaEnums: Cogen[ScalaEnums.Color.Type] = Cogen(_.id.toLong)
implicit def coUnsafeEnum[T: Cogen]: Cogen[UnsafeEnum[T]] = Cogen.gen[UnsafeEnum[T]]
implicit def coUnsafeEnum[T: Cogen]: Cogen[UnsafeEnum[T]] =
Cogen { (seed: Seed, value: UnsafeEnum[T]) =>
value match {
case UnsafeEnum.Known(v) => Cogen[T].perturb(seed, v)
case UnsafeEnum.Unknown(v) => Cogen[String].perturb(seed, v)
}
}

// ADT
implicit lazy val coNode: Cogen[Node] = Cogen.gen[Node]
Expand Down

0 comments on commit 27c1fb2

Please sign in to comment.