I accidentally stumbled upon this problem when I was experimenting with abstract classes. The following code:
import shapeless._
class A
[tuple <: Product, hlist <: HList]
(tuple: tuple)
(implicit tupleGeneric: Generic.Aux[tuple, hlist])
{
private val hlist = tupleGeneric.to(tuple)
println(hlist)
}
new A((1, 'b')) {}
will not compile with the following message:
could not find implicit value for parameter tupleGeneric: shapeless.Generic.Aux[(Int, Char),shapeless.::[Int,shapeless.::[Char,shapeless.HNil]]]
new A((1, 'b')) {}
^
However, if I simply remove the part {}from new A((1, 'b')) {}, it will find that it is implicitly without problems.
Is this a Scala bug or am I missing something?
source
share