-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
The following code is minimized from ScalaTest, which compiles fine in Scala 2.12.8, but causes a stackoverflow in Dotty:
class Test {
def to[Col[_]](factory: Factory[Int, Col[Int]]): Col[Int] = ???
to(Vector)
type Factory[-A, +C] = scala.collection.generic.CanBuildFrom[Nothing, A, C] // Ideally, this would be an opaque type
implicit def fromCanBuildFromConversion[X, A, C](x: X)(
implicit toCanBuildFrom: X => scala.collection.generic.CanBuildFrom[Nothing, A, C]): Factory[A, C] = ???
implicit def genericCompanionToCBF[A, CC[X] <: scala.collection.GenTraversable[X]](
fact: scala.collection.generic.GenericCompanion[CC]): scala.collection.generic.CanBuildFrom[Any, A, CC[A]] = ???
}Note that in the above, if we comment out fromCanBuildFromConversion, it compiles both in Scala 2.12.8 and Dotty.
This seems to be the culprit of a compiler hang when working with a test in Scalactic.
Chain(1, 2, 3).to(Vector) shouldBe Vector(1, 2, 3)