Skip to content

Commit

Permalink
fix: make union_derivation private (#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThijsBroersen authored Jun 27, 2024
1 parent 4930439 commit 6d2abd4
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import scala.deriving.*
import scala.quoted.*

@scala.annotation.implicitNotFound("${A} is not a union of ${T}")
sealed trait IsUnionOf[T, A]
private[json] sealed trait IsUnionOf[T, A]

object IsUnionOf:
private[json] object IsUnionOf:

private val singleton: IsUnionOf[Any, Any] = new IsUnionOf[Any, Any] {}

Expand Down Expand Up @@ -35,7 +35,7 @@ object IsUnionOf:
if o <:< bound then ('{ IsUnionOf.singleton.asInstanceOf[IsUnionOf[T, A]] }).asExprOf[IsUnionOf[T, A]]
else report.errorAndAbort(s"${tpe.show} is not a Union")

object UnionDerivation:
private[json] object UnionDerivation:
transparent inline def constValueUnionTuple[T, A](using IsUnionOf[T, A]): Tuple = ${ constValueUnionTupleImpl[T, A] }

private def constValueUnionTupleImpl[T: Type, A: Type](using Quotes): Expr[Tuple] =
Expand Down

0 comments on commit 6d2abd4

Please sign in to comment.