Open eejbyfeldt opened 1 year ago
Maybe related the code
trait S[T]
trait TypeClass[U]
object TypeClass {
implicit def forS[U: TypeClass, C <: S[U]]: TypeClass[C] = null
}
object Test {
implicitly[TypeClass[Int]]
}
fails to compile with
error: diverging implicit expansion for type example.TypeClass[Int]
starting with method forS in object TypeClass
implicitly[TypeClass[Int]]
^
1 error
so it seems like the implicit forS
diverges with itself?
Reproduction steps
Scala version: 2.13.10 and 2.12.17 but reproduced with all 2.x builds I tried. But seems to be fixed in scala 3
Problem
The code fails to compile with
but I would expect it to compile without errors using the
forInt
to create the implicitTypeClass[S2]]