diff --git a/modules/deriving/src/main/scala/shapeless3/deriving/internals/reflectionutils.scala b/modules/deriving/src/main/scala/shapeless3/deriving/internals/reflectionutils.scala index e0a3709..9dfdd61 100644 --- a/modules/deriving/src/main/scala/shapeless3/deriving/internals/reflectionutils.scala +++ b/modules/deriving/src/main/scala/shapeless3/deriving/internals/reflectionutils.scala @@ -20,8 +20,8 @@ import scala.annotation.tailrec import scala.deriving.* import scala.quoted.* -private[shapeless3] class ReflectionUtils[Q <: Quotes & Singleton](val q: Q): - private given q.type = q +class ReflectionUtils[Q <: Quotes & Singleton](val q: Q): + given q.type = q import q.reflect.* case class Mirror( @@ -51,17 +51,17 @@ private[shapeless3] class ReflectionUtils[Q <: Quotes & Singleton](val q: Q): case _: ImplicitSearchFailure => None instance.flatMap(Mirror(_)) - def tupleTypeElements(tp: TypeRepr): List[TypeRepr] = + private def tupleTypeElements(tp: TypeRepr): List[TypeRepr] = @tailrec def loop(tp: TypeRepr, acc: List[TypeRepr]): List[TypeRepr] = tp match case AppliedType(_, List(hd: TypeRepr, tl: TypeRepr)) => loop(tl, hd :: acc) case _ => acc loop(tp, Nil).reverse - def low(tp: TypeRepr): TypeRepr = tp match + private def low(tp: TypeRepr): TypeRepr = tp match case tp: TypeBounds => tp.low case tp => tp - def findMemberType(tp: TypeRepr, name: String): Option[TypeRepr] = tp match + private def findMemberType(tp: TypeRepr, name: String): Option[TypeRepr] = tp match case Refinement(_, `name`, tp) => Some(low(tp)) case Refinement(parent, _, _) => findMemberType(parent, name) case AndType(left, right) => findMemberType(left, name).orElse(findMemberType(right, name)) diff --git a/modules/typeable/src/main/scala/shapeless3/typeable/reflectionutils.scala b/modules/typeable/src/main/scala/shapeless3/typeable/reflectionutils.scala index 221ce87..42e36f3 100644 --- a/modules/typeable/src/main/scala/shapeless3/typeable/reflectionutils.scala +++ b/modules/typeable/src/main/scala/shapeless3/typeable/reflectionutils.scala @@ -51,17 +51,17 @@ class ReflectionUtils[Q <: Quotes & Singleton](val q: Q): case _: ImplicitSearchFailure => None instance.flatMap(Mirror(_)) - def tupleTypeElements(tp: TypeRepr): List[TypeRepr] = + private def tupleTypeElements(tp: TypeRepr): List[TypeRepr] = @tailrec def loop(tp: TypeRepr, acc: List[TypeRepr]): List[TypeRepr] = tp match case AppliedType(_, List(hd: TypeRepr, tl: TypeRepr)) => loop(tl, hd :: acc) case _ => acc loop(tp, Nil).reverse - def low(tp: TypeRepr): TypeRepr = tp match + private def low(tp: TypeRepr): TypeRepr = tp match case tp: TypeBounds => tp.low case tp => tp - def findMemberType(tp: TypeRepr, name: String): Option[TypeRepr] = tp match + private def findMemberType(tp: TypeRepr, name: String): Option[TypeRepr] = tp match case Refinement(_, `name`, tp) => Some(low(tp)) case Refinement(parent, _, _) => findMemberType(parent, name) case AndType(left, right) => findMemberType(left, name).orElse(findMemberType(right, name))