scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Regression for method dispatch in `7mind/izumi`

Open WojciechMazur opened this issue 6 months ago • 5 comments

Compiler version

Last good release: 3.6.0-RC1-bin-20240719-af933c4-NIGHTLY First bad release: 3.6.0-RC1-bin-20240723-46ff151-NIGHTLY

Bisect scripts failed to build the compiler for some revisions, the first bad commit could be any of: 3b3b8a77ef911825bfb0d5dc5406b641332aaa07 637b1d3dc3ddddd0cbe3e2a4ac5ec3e972a6ad05 2cfc5619b5b5089527d56b11e5189918f881bcfe 875af444d008f84dedc39cc531779c0dc76a895c dec395be75633cc1b609dea9808b9abe4ef1bb06

Minimized code

trait IO2[F[_, _]]:
  def apply[A](effect: => A): F[Throwable, A] = ???

trait  syntax:
  def IO2[F[_, _], A](effect: => A)(implicit F: IO2[F]): F[Throwable, A] = ???
  def IO2[F[_, _]: IO2]: IO2[F] = ???

class Test extends syntax:
  class X[F[_, _]: IO2]:
    def fails = IO2(println("hello world!"))
    def works = IO2(println("hello world!"))(using summon[IO2[F]])

Output

[error] ./src/test.scala:10:17
[error] Ambiguous overload. The overloaded alternatives of method IO2 in trait syntax with types
[error]  [F[_$5,_$6]](using evidence$1: IO2[F]): IO2[F]
[error]  [F[_$3,_$4], A](effect: => A)(implicit F: IO2[F]): F[Throwable, A]
[error] both match arguments (Unit)
[error]     def fails = IO2(println("hello world!"))
[error]                 ^^^

Expectation

Should compile

WojciechMazur avatar Jul 31 '24 10:07 WojciechMazur