-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Milestone
Description
When an extension method is defined for a typeclass more than once but with different arguments, it fails to construct if the method argument has type arguments. If we were to remove the type arguments, the method construction works.
Compiler version
v3.1.0-RC2
Minimized code
class MyType()
trait Candidate[R]
given Candidate[MyType] with {}
class Fuzzy[W]()
class Fuzzy1()
class Bear()
extension [L](lhs: L)(using Candidate[L])
def +[RW](rhs: Fuzzy[RW]): Unit = {}
def +(rhs: Bear): Unit = {}
def -(rhs: Fuzzy1): Unit = {}
def -(rhs: Bear): Unit = {}
val works = MyType() - Fuzzy1()
val fails = MyType() + Fuzzy[1]()
Output
[error] 15 |val fails = MyType() + Fuzzy[1]()
[error] | ^^^^^^^^^^
[error] | value + is not a member of MyType.
[error] | An extension method was tried, but could not be fully constructed:
[error] |
[error] | +() failed with
[error] |
[error] | value +: <overloaded +> does not take parameters
[error] one error found
Expectation
No error.