문제

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?

도움이 되었습니까?

해결책

Turns out it is a recognized bug.

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top