File tree 1 file changed +6
-3
lines changed 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,10 @@ object Deriving {
57
57
def fromProduct (p : scala.Product ): T
58
58
}
59
59
60
- class Singleton [T ](val value : T ) extends Generic [T ] {
60
+ class Singleton [T ] extends Generic [T ] {
61
+ inline def singletonValue = implicit match {
62
+ case ev : ValueOf [T ] => ev.value
63
+ }
61
64
type CaseLabel <: String
62
65
}
63
66
}
@@ -103,7 +106,7 @@ object Lst {
103
106
}
104
107
105
108
case object Nil extends Lst [Nothing ] {
106
- class GenericNil extends Generic .Singleton [Nil .type ]( Nil ) {
109
+ class GenericNil extends Generic .Singleton [Nil .type ] {
107
110
type CaseLabel = " Nil"
108
111
}
109
112
implicit def GenericNil : GenericNil = new GenericNil
@@ -310,7 +313,7 @@ object Pickler {
310
313
else if (ord == n)
311
314
inline g.alternative(n) match {
312
315
case g : Generic .Product [p] => unpickleProduct(g)(buf)
313
- case g : Generic .Singleton [s] => g.value
316
+ case g : Generic .Singleton [s] => g.singletonValue
314
317
}
315
318
else unpickleCases[T ](g, n + 1 )(buf, ord)
316
319
You can’t perform that action at this time.
0 commit comments