From 4a8edc03653cb0f6b6ed1cdea1779a19df20f8f5 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 4 Feb 2014 15:55:59 +0100 Subject: SI-8129 Make Object#== override Any#== And the same for != If we tried to declare these signatures in non-fictional classes, we would be chastised about collapsing into the "same signature after erasure". This will have an influence of typing, as the typechecking of arguments is sensitive to overloading: if multiple variants are feasible, the argument will be typechecked with a wildcard expected type. So people inspecting the types of the arguments to `==` before this change might have seen an interesting type for `if (true) x else y`, but now the `If` will have type `Any`, as we don't need to calculate the LUB. I've left a TODO to note that we should really make `Any#{==, !=}` non-final and include a final override in `AnyVal`. But I don't think that is particularly urgent. --- test/files/run/reflection-magicsymbols-invoke.check | 4 ---- 1 file changed, 4 deletions(-) (limited to 'test/files/run') diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check index 43116858de..037ba33d21 100644 --- a/test/files/run/reflection-magicsymbols-invoke.check +++ b/test/files/run/reflection-magicsymbols-invoke.check @@ -36,12 +36,10 @@ it's important to print the list of AnyRef's members if some of them change (possibly, adding and/or removing magic symbols), we must update this test constructor Object: ()java.lang.Object method !=: (x$1: Any)Boolean -method !=: (x$1: AnyRef)Boolean method ##: ()Int method $asInstanceOf: [T0]()T0 method $isInstanceOf: [T0]()Boolean method ==: (x$1: Any)Boolean -method ==: (x$1: AnyRef)Boolean method asInstanceOf: [T0]=> T0 method clone: ()java.lang.Object method eq: (x$1: AnyRef)Boolean @@ -84,12 +82,10 @@ if some of them change (possibly, adding and/or removing magic symbols), we must constructor Array: (_length: Int)Array[T] constructor Cloneable: ()java.lang.Cloneable method !=: (x$1: Any)Boolean -method !=: (x$1: AnyRef)Boolean method ##: ()Int method $asInstanceOf: [T0]()T0 method $isInstanceOf: [T0]()Boolean method ==: (x$1: Any)Boolean -method ==: (x$1: AnyRef)Boolean method apply: (i: Int)T method asInstanceOf: [T0]=> T0 method clone: ()Array[T] -- cgit v1.2.3