Open
Description
Compiler version
Scala 3.2.1
Minimized code
case class Foo[A](a: A) {
def bar(aa: A): Boolean = a == aa
def bar(that: Foo[A]) = a == that.a
}
object Test {
Foo(123).bar(Foo(456))
}
Output
The snippet compiles just fine on 2.12.17 and 2.13.9, but fails to compile on 3.2.1 with the following error:
7 | Foo(123).bar(Foo(456))
| ^^^^^^^^^^^^
|Ambiguous overload. The overloaded alternatives of method bar in class Foo with types
| (that: Foo[A]): Boolean
| (aa: A): Boolean
|both match arguments (Foo[A])
However, if I change the Test
object this way:
object Test {
val foo123 = Foo(123)
foo123.bar(Foo(456))
}
then it compiles on 3.2.1 without any error as well.
Expectation
Both cases should compile on 3.2.1.