You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SI-8219 Pending test to show suspicous overload in == in AnyRef
% scalac-hash v2.11.0-M7 test/pending/neg/t8219-any-any-ref-equals.scala
test/pending/neg/t8219-any-any-ref-equals.scala:5: error: overloaded method value == with alternatives:
(x$1: AnyRef)Boolean <and>
(x$1: Any)Boolean
does not take type parameters
"".==[Int]
^
one error found
Usually for Java-originated methods, we are allow Object and Any
to unify pre-erasure in method signatures. This is handled in
`matchesParams`, and is predicated on whether the method type is
an instance of `JavaMethodType`
For instance, we are allowed to:
scala> class C { override def equals(a: Any) = false }
defined class C
On account of:
scala> typeOf[Object].decl(nme.equals_).info.getClass
res7: Class[_ <: $r.intp.global.Type] = class scala.reflect.internal.Types$JavaMethodType
But:
scala> typeOf[Object].decl(nme.EQ).defString
res8: String = final def ==(x$1: AnyRef): Boolean
scala> typeOf[Object].decl(nme.EQ).info.getClass
res9: Class[_ <: $r.intp.global.Type] = class scala.reflect.internal.Types$MethodType
More special casing is probably needed.
0 commit comments