Question

I've stumbled upon this issue by accident 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')) {}

fails to 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 finds that implicit with no problem.

Is this a Scala bug or am I missing something?

Was it helpful?

Solution

Turns out it is a recognized bug.

https://issues.scala-lang.org/browse/SI-8104

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top