Open
Description
Reproduction steps
Scala version: 2.13.8
trait ByNameImplicit[A, B]
object ByNameImplicit {
implicit def invert[A, B](implicit ab: => ByNameImplicit[A, B]): ByNameImplicit[B, A] =
new ByNameImplicit[B, A] {}
}
abstract class Class1[A](implicit val byNameImpl: ByNameImplicit[A, A])
abstract class Class2 extends Class1[Int]
// Implementation restriction: class LazyDefns$1 requires premature access to class Class2.
Here's the same code in a scastie: https://scastie.scala-lang.org/mrdziuban/KhMLbN5dSQCMIbaQARLN7g/1
Problem
I'm not 100% sure what's expected here, but the error caught me off guard. It didn't point to any particular code so I only determined it was related to by-name implicits by googling and finding mention of LazyDefns$1
in the documentation for implicits.
For what it's worth, the error does not happen with Scala 3.x.