The following:
object SomeObj {
def addVertex(cc: Product): String = ???
def addVertex(cc: AnyRef): String = ???
}
case class Toto(s: String)
SomeObj.addVertex(Toto(""))
Is doing:
Error:(8, 10) ambiguous reference to overloaded definition,
both method addVertex in object SomeObj of type (cc: Object)String
and method addVertex in object SomeObj of type (cc: Product)String
match argument types (A$A34.this.Toto)
SomeObj.addVertex(Toto(""));}
^
Why? Shouldn't it go for the most specific one?
Interestingly with Any
instead of AnyRef
it works.
Cheers