diff --git a/modules/core/src/main/scala-3/tethys/derivation/ConfigurationMacroUtils.scala b/modules/core/src/main/scala-3/tethys/derivation/ConfigurationMacroUtils.scala index b4193ba..7f57a5d 100644 --- a/modules/core/src/main/scala-3/tethys/derivation/ConfigurationMacroUtils.scala +++ b/modules/core/src/main/scala-3/tethys/derivation/ConfigurationMacroUtils.scala @@ -752,17 +752,19 @@ trait ConfigurationMacroUtils: case '[t *: ts] => TypeRepr.of[t] :: typeReprsOf[ts] def getAllChildren(tpe: TypeRepr): List[TypeRepr] = - tpe.asType match - case '[t] => - Expr.summon[scala.deriving.Mirror.Of[t]] match - case Some('{ - $m: scala.deriving.Mirror.SumOf[t] { - type MirroredElemTypes = subs - } - }) => - typeReprsOf[subs].flatMap(getAllChildren) - case _ => - List(tpe) + def loop(tpe: TypeRepr): List[TypeRepr] = + tpe.asType match + case '[t] => + Expr.summon[scala.deriving.Mirror.Of[t]] match + case Some('{ + $m: scala.deriving.Mirror.SumOf[t] { + type MirroredElemTypes = subs + } + }) => + typeReprsOf[subs].flatMap(loop) + case _ => + List(tpe) + loop(tpe).distinct case class SelectedField(name: String, selector: Term)