@@ -207,6 +207,7 @@ object datatypes {
207
207
}
208
208
209
209
object typeclasses {
210
+ import compiletime .summonFrom
210
211
// A typeclass
211
212
trait Eq [T ] {
212
213
def eql (x : T , y : T ): Boolean
@@ -217,7 +218,7 @@ object typeclasses {
217
218
import compiletime ._
218
219
import scala .deriving ._
219
220
220
- inline def tryEql [TT ](x : TT , y : TT ): Boolean = delegate match {
221
+ inline def tryEql [TT ](x : TT , y : TT ): Boolean = summonFrom {
221
222
case eq : Eq [TT ] => eq.eql(x, y)
222
223
}
223
224
@@ -237,7 +238,7 @@ object typeclasses {
237
238
inline erasedValue[Alts ] match {
238
239
case _ : (alt *: alts1) =>
239
240
if (ord == n)
240
- delegate match {
241
+ summonFrom {
241
242
case m : Mirror .ProductOf [`alt`] => eqlElems[m.MirroredElemTypes ](0 )(x, y)
242
243
}
243
244
else eqlCases[alts1](n + 1 )(x, y, ord)
@@ -274,7 +275,7 @@ object typeclasses {
274
275
275
276
def nextInt (buf : mutable.ListBuffer [Int ]): Int = try buf.head finally buf.trimStart(1 )
276
277
277
- inline def tryPickle [T ](buf : mutable.ListBuffer [Int ], x : T ): Unit = delegate match {
278
+ inline def tryPickle [T ](buf : mutable.ListBuffer [Int ], x : T ): Unit = summonFrom {
278
279
case pkl : Pickler [T ] => pkl.pickle(buf, x)
279
280
}
280
281
@@ -290,14 +291,14 @@ object typeclasses {
290
291
inline erasedValue[Alts ] match {
291
292
case _ : (alt *: alts1) =>
292
293
if (ord == n)
293
- delegate match {
294
+ summonFrom {
294
295
case m : Mirror .ProductOf [`alt`] => pickleElems[m.MirroredElemTypes ](0 )(buf, x)
295
296
}
296
297
else pickleCases[alts1](n + 1 )(buf, x, ord)
297
298
case _ : Unit =>
298
299
}
299
300
300
- inline def tryUnpickle [T ](buf : mutable.ListBuffer [Int ]): T = delegate match {
301
+ inline def tryUnpickle [T ](buf : mutable.ListBuffer [Int ]): T = summonFrom {
301
302
case pkl : Pickler [T ] => pkl.unpickle(buf)
302
303
}
303
304
@@ -324,7 +325,7 @@ object typeclasses {
324
325
inline erasedValue[Alts ] match {
325
326
case _ : (alt *: alts1) =>
326
327
if (ord == n)
327
- delegate match {
328
+ summonFrom {
328
329
case m : Mirror .ProductOf [`alt` & T ] =>
329
330
unpickleCase[`alt` & T , m.MirroredElemTypes ](buf, m)
330
331
}
0 commit comments