Skip to content

Commit 4d84b4c

Browse files
committed
Test case: Drop value argument of Generic.Singleton
1 parent 2243e2d commit 4d84b4c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/run/typeclass-derivation2c.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ object Deriving {
5757
def fromProduct(p: scala.Product): T
5858
}
5959

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+
}
6164
type CaseLabel <: String
6265
}
6366
}
@@ -103,7 +106,7 @@ object Lst {
103106
}
104107

105108
case object Nil extends Lst[Nothing] {
106-
class GenericNil extends Generic.Singleton[Nil.type](Nil) {
109+
class GenericNil extends Generic.Singleton[Nil.type] {
107110
type CaseLabel = "Nil"
108111
}
109112
implicit def GenericNil: GenericNil = new GenericNil
@@ -310,7 +313,7 @@ object Pickler {
310313
else if (ord == n)
311314
inline g.alternative(n) match {
312315
case g: Generic.Product[p] => unpickleProduct(g)(buf)
313-
case g: Generic.Singleton[s] => g.value
316+
case g: Generic.Singleton[s] => g.singletonValue
314317
}
315318
else unpickleCases[T](g, n + 1)(buf, ord)
316319

0 commit comments

Comments
 (0)