@@ -227,9 +227,7 @@ object Eq {
227
227
import scala .compiletime .{erasedValue , error , summonFrom }
228
228
import TypeLevel ._
229
229
230
- inline def tryEql [T ](x : T , y : T ) = summonFrom {
231
- case eq : Eq [T ] => eq.eql(x, y)
232
- }
230
+ inline def tryEql [T ](x : T , y : T ) = summonInline[Eq [T ]].eql(x, y)
233
231
234
232
inline def eqlElems [Elems <: Tuple ](xm : Mirror , ym : Mirror , n : Int ): Boolean =
235
233
inline erasedValue[Elems ] match {
@@ -283,14 +281,12 @@ trait Pickler[T] {
283
281
}
284
282
285
283
object Pickler {
286
- import scala .compiletime .{erasedValue , constValue , error , summonFrom }
284
+ import scala .compiletime .{erasedValue , constValue , error , summonInline }
287
285
import TypeLevel ._
288
286
289
287
def nextInt (buf : mutable.ListBuffer [Int ]): Int = try buf.head finally buf.trimStart(1 )
290
288
291
- inline def tryPickle [T ](buf : mutable.ListBuffer [Int ], x : T ): Unit = summonFrom {
292
- case pkl : Pickler [T ] => pkl.pickle(buf, x)
293
- }
289
+ inline def tryPickle [T ](buf : mutable.ListBuffer [Int ], x : T ): Unit = summonInline[Pickler [T ]].pickle(buf, x)
294
290
295
291
inline def pickleElems [Elems <: Tuple ](buf : mutable.ListBuffer [Int ], elems : Mirror , n : Int ): Unit =
296
292
inline erasedValue[Elems ] match {
@@ -321,9 +317,7 @@ object Pickler {
321
317
case _ : Unit =>
322
318
}
323
319
324
- inline def tryUnpickle [T ](buf : mutable.ListBuffer [Int ]): T = summonFrom {
325
- case pkl : Pickler [T ] => pkl.unpickle(buf)
326
- }
320
+ inline def tryUnpickle [T ](buf : mutable.ListBuffer [Int ]): T = summonInline[Pickler [T ]].unpickle(buf)
327
321
328
322
inline def unpickleElems [Elems <: Tuple ](buf : mutable.ListBuffer [Int ], elems : Array [AnyRef ], n : Int ): Unit =
329
323
inline erasedValue[Elems ] match {
@@ -382,9 +376,7 @@ object Show {
382
376
import scala .compiletime .{erasedValue , error , summonFrom }
383
377
import TypeLevel ._
384
378
385
- inline def tryShow [T ](x : T ): String = summonFrom {
386
- case s : Show [T ] => s.show(x)
387
- }
379
+ inline def tryShow [T ](x : T ): String = summonInline[Show [T ]].show(x)
388
380
389
381
inline def showElems [Elems <: Tuple ](elems : Mirror , n : Int ): List [String ] =
390
382
inline erasedValue[Elems ] match {
0 commit comments