Open
Description
Compiler version
3.7.0
Minimized example
class A(p1: String, p2: Int)
object A {
def apply(p1: String, p2: Int): A = A(p1, p2)
def apply(p1: String)(p2: Int): A = A(p1, p2)
}
Output Error/Warning message
The error message from Scastie:
Double definition:
def apply(p1: String, p2: Int): Playground.A in object A at line 5 and
def apply(p1: String)(p2: Int): Playground.A in object A at line 6
have the same type after erasure.
Consider adding a @targetName annotation to one of the conflicting definitions
for disambiguation.
Why this Error/Warning was not helpful
I don't know what I am supposed to do with this message.
It doesn't explain to me how to fix the code, what the "same type" is or what type erasure means in my specific situation.
Suggested improvement
If multiple parameter groups are being concatenated together in the compiler it would be useful to mention that as the reason why this code is not allowed. Type erasure in general shouldn't be mentioned as it seems like an implementation detail.