Skip to content

Divergence checker does not detect loop with higher-kinded type and by-name implicit #9568

Closed
@smarter

Description

@smarter

Minimized code

This is exactly the same code as #9504, but the implicit parameter has been marked as by-name:

trait Monad[F[_]] {
  def foo[A](fa: F[A]): Unit = {}
}

class Bla[F[_], A]

object Test {
  type Id[A] = A

  val bla: Bla[Id, Unit] = ???
  implicit def blaMonad[F[_], S](implicit ev: => Monad[F]): Monad[({type L[X] = Bla[F, X]})#L] = ???

  blaMonad.foo(bla) // diverges
}

Expectation

It should behave like the non by-name case and error out immediately (this bug also affects #9523 where an existing testcase with a by-name implicit is not caught by the divergence checker anymore)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions