File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
core/src/main/scala/magnolia1 Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -184,17 +184,19 @@ trait SealedTraitDerivation:
184
184
185
185
protected transparent inline def subtypesFromMirror [A , SubtypeTuple <: Tuple ](
186
186
m : Mirror .SumOf [A ],
187
- idx : Int = 0 // no longer used, kept for bincompat
187
+ idx : Int = 0 , // no longer used, kept for bincompat
188
+ result : List [SealedTrait .Subtype [Typeclass , A , _]] = Nil
188
189
): List [SealedTrait .Subtype [Typeclass , A , _]] =
189
190
inline erasedValue[SubtypeTuple ] match
190
191
case _ : EmptyTuple =>
191
- Nil
192
+ result.distinctBy(_.typeInfo).sortBy(_.typeInfo.full)
192
193
case _ : (s *: tail) =>
193
194
val sub = summonFrom {
194
195
case mm : Mirror .SumOf [`s`] =>
195
196
subtypesFromMirror[A , mm.MirroredElemTypes ](
196
197
mm.asInstanceOf [m.type ],
197
- 0
198
+ 0 ,
199
+ Nil
198
200
)
199
201
case _ => {
200
202
val tc = new SerializableFunction0 [Typeclass [s]]:
@@ -221,5 +223,5 @@ trait SealedTraitDerivation:
221
223
)
222
224
}
223
225
}
224
- (sub ::: subtypesFromMirror[A , tail](m, idx + 1 )).distinctBy(_.typeInfo).sortBy(_.typeInfo.full )
226
+ subtypesFromMirror[A , tail](m, idx + 1 , sub ::: result )
225
227
end SealedTraitDerivation
You can’t perform that action at this time.
0 commit comments