@@ -109,7 +109,8 @@ object ValueEnumMacros {
109
109
tpe : Type [A ],
110
110
valueTpe : Type [ValueType ]
111
111
)(using cls : ClassTag [ValueType ]): Expr [IndexedSeq [A ]] = {
112
- type TakeHead [Head <: A & Singleton , Tail <: Tuple ] = Head *: Tail
112
+ type SingletonHead [Head <: A & Singleton , Tail <: Tuple ] = Head *: Tail
113
+ type ProductHead [Head <: A , Tail <: Tuple ] = Head *: Tail
113
114
114
115
type SumOf [X <: A , T <: Tuple ] = Mirror .SumOf [X ] {
115
116
type MirroredElemTypes = T
@@ -186,7 +187,7 @@ In SBT settings:
186
187
values : Map [TypeRepr , ValueType ]
187
188
)(using tupleTpe : Type [T ]): Either [String , Expr [List [A ]]] =
188
189
tupleTpe match {
189
- case ' [TakeHead [h, tail]] => {
190
+ case ' [SingletonHead [h, tail]] => {
190
191
val htpr = TypeRepr .of[h]
191
192
192
193
(for {
@@ -224,6 +225,19 @@ In SBT settings:
224
225
}
225
226
}
226
227
228
+ case ' [ProductHead [h, tail]] =>
229
+ Expr .summon[Mirror .SumOf [h]] match {
230
+ case Some (sum) =>
231
+ sum.asTerm.tpe.asType match {
232
+ case ' [SumOf [a, t]] => collect[Tuple .Concat [t, tail]](instances, values)
233
+
234
+ case _ => Left (s " Invalid `Mirror.SumOf[ ${TypeRepr .of[h].show}] " )
235
+ }
236
+
237
+ case None =>
238
+ Left (s " Missing `Mirror.SumOf[ ${TypeRepr .of[h].show}]` " )
239
+ }
240
+
227
241
case ' [EmptyTuple ] => {
228
242
val allowAlias = repr <:< TypeRepr .of[AllowAlias ]
229
243
0 commit comments