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/presentation/callcc-interpreter.check | 4 +--- .../presentation/completion-implicit-chained.check | 4 +--- test/files/presentation/ide-bug-1000349.check | 4 +--- test/files/presentation/ide-bug-1000475.check | 12 +++--------- test/files/presentation/ide-bug-1000531.check | 4 +--- test/files/presentation/implicit-member.check | 4 +--- test/files/presentation/ping-pong.check | 8 ++------ test/files/presentation/t5708.check | 4 +--- test/files/presentation/visibility.check | 20 +++++--------------- 9 files changed, 16 insertions(+), 48 deletions(-) (limited to 'test/files/presentation') diff --git a/test/files/presentation/callcc-interpreter.check b/test/files/presentation/callcc-interpreter.check index 1f868097ca..4bf68b3d4e 100644 --- a/test/files/presentation/callcc-interpreter.check +++ b/test/files/presentation/callcc-interpreter.check @@ -3,7 +3,7 @@ reload: CallccInterpreter.scala askTypeCompletion at CallccInterpreter.scala(51,34) ================================================================================ [response] askTypeCompletion at (51,34) -retrieved 59 members +retrieved 57 members abstract trait Term extends AnyRef abstract trait Value extends AnyRef case class Add extends callccInterpreter.Term with Product with Serializable @@ -38,10 +38,8 @@ def toString(): String def unitM[A](a: A): callccInterpreter.M[A] def →[B](y: B): (callccInterpreter.type, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean diff --git a/test/files/presentation/completion-implicit-chained.check b/test/files/presentation/completion-implicit-chained.check index f9d77f7a53..c583b7877c 100644 --- a/test/files/presentation/completion-implicit-chained.check +++ b/test/files/presentation/completion-implicit-chained.check @@ -3,7 +3,7 @@ reload: Completions.scala askTypeCompletion at Completions.scala(11,16) ================================================================================ [response] askTypeCompletion at (11,16) -retrieved 24 members +retrieved 22 members [inaccessible] protected[package lang] def clone(): Object [inaccessible] protected[package lang] def finalize(): Unit def equals(x$1: Any): Boolean @@ -11,10 +11,8 @@ def hashCode(): Int def map(x: Int => Int)(implicit a: DummyImplicit): test.O.type def toString(): String final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean diff --git a/test/files/presentation/ide-bug-1000349.check b/test/files/presentation/ide-bug-1000349.check index c59fa6843f..79bfde5343 100644 --- a/test/files/presentation/ide-bug-1000349.check +++ b/test/files/presentation/ide-bug-1000349.check @@ -3,7 +3,7 @@ reload: CompletionOnEmptyArgMethod.scala askTypeCompletion at CompletionOnEmptyArgMethod.scala(2,17) ================================================================================ [response] askTypeCompletion at (2,17) -retrieved 32 members +retrieved 30 members def +(other: String): String def ->[B](y: B): (Foo, B) def ensuring(cond: Boolean): Foo @@ -17,10 +17,8 @@ def hashCode(): Int def toString(): String def →[B](y: B): (Foo, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean diff --git a/test/files/presentation/ide-bug-1000475.check b/test/files/presentation/ide-bug-1000475.check index f5b4253e1a..4fb7f18285 100644 --- a/test/files/presentation/ide-bug-1000475.check +++ b/test/files/presentation/ide-bug-1000475.check @@ -3,7 +3,7 @@ reload: Foo.scala askTypeCompletion at Foo.scala(3,7) ================================================================================ [response] askTypeCompletion at (3,7) -retrieved 31 members +retrieved 29 members [inaccessible] protected[package lang] def clone(): Object [inaccessible] protected[package lang] def finalize(): Unit def +(other: String): String @@ -18,10 +18,8 @@ def hashCode(): Int def toString(): String def →[B](y: B): (Object, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean @@ -37,7 +35,7 @@ final def wait(x$1: Long,x$2: Int): Unit askTypeCompletion at Foo.scala(6,10) ================================================================================ [response] askTypeCompletion at (6,10) -retrieved 31 members +retrieved 29 members [inaccessible] protected[package lang] def clone(): Object [inaccessible] protected[package lang] def finalize(): Unit def +(other: String): String @@ -52,10 +50,8 @@ def hashCode(): Int def toString(): String def →[B](y: B): (Object, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean @@ -71,7 +67,7 @@ final def wait(x$1: Long,x$2: Int): Unit askTypeCompletion at Foo.scala(7,7) ================================================================================ [response] askTypeCompletion at (7,7) -retrieved 31 members +retrieved 29 members [inaccessible] protected[package lang] def clone(): Object [inaccessible] protected[package lang] def finalize(): Unit def +(other: String): String @@ -86,10 +82,8 @@ def hashCode(): Int def toString(): String def →[B](y: B): (Object, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check index dff89b155b..ef8a1d12de 100644 --- a/test/files/presentation/ide-bug-1000531.check +++ b/test/files/presentation/ide-bug-1000531.check @@ -3,7 +3,7 @@ reload: CrashOnLoad.scala askTypeCompletion at CrashOnLoad.scala(6,12) ================================================================================ [response] askTypeCompletion at (6,12) -retrieved 120 members +retrieved 118 members [inaccessible] protected[package lang] def clone(): Object [inaccessible] protected[package lang] def finalize(): Unit [inaccessible] protected[this] def reversed: List[B] @@ -107,10 +107,8 @@ def zipWithIndex: Iterator[(B, Int)] def zip[B](that: Iterator[B]): Iterator[(B, B)] def →[B](y: B): (java.util.Iterator[B], B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean diff --git a/test/files/presentation/implicit-member.check b/test/files/presentation/implicit-member.check index 5ad52b4dd3..3bd3d8af41 100644 --- a/test/files/presentation/implicit-member.check +++ b/test/files/presentation/implicit-member.check @@ -3,7 +3,7 @@ reload: ImplicitMember.scala askTypeCompletion at ImplicitMember.scala(7,7) ================================================================================ [response] askTypeCompletion at (7,7) -retrieved 34 members +retrieved 32 members def +(other: String): String def ->[B](y: B): (Implicit.type, B) def ensuring(cond: Boolean): Implicit.type @@ -17,10 +17,8 @@ def toString(): String def →[B](y: B): (Implicit.type, B) final class AppliedImplicit[A] extends AnyRef final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean diff --git a/test/files/presentation/ping-pong.check b/test/files/presentation/ping-pong.check index 20f17aa7d0..ab4cfc9e7a 100644 --- a/test/files/presentation/ping-pong.check +++ b/test/files/presentation/ping-pong.check @@ -3,7 +3,7 @@ reload: PingPong.scala askTypeCompletion at PingPong.scala(10,23) ================================================================================ [response] askTypeCompletion at (10,23) -retrieved 35 members +retrieved 33 members [inaccessible] private[this] val ping: Ping [inaccessible] protected[package lang] def clone(): Object [inaccessible] protected[package lang] def finalize(): Unit @@ -19,10 +19,8 @@ def hashCode(): Int def poke(): Unit def →[B](y: B): (Pong, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean @@ -40,7 +38,7 @@ private[this] val name: String askTypeCompletion at PingPong.scala(19,20) ================================================================================ [response] askTypeCompletion at (19,20) -retrieved 35 members +retrieved 33 members [inaccessible] protected[package lang] def clone(): Object [inaccessible] protected[package lang] def finalize(): Unit def +(other: String): String @@ -57,10 +55,8 @@ def name: String def poke: Unit def →[B](y: B): (Ping, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean diff --git a/test/files/presentation/t5708.check b/test/files/presentation/t5708.check index 04806b5867..4b33893e98 100644 --- a/test/files/presentation/t5708.check +++ b/test/files/presentation/t5708.check @@ -3,7 +3,7 @@ reload: Completions.scala askTypeCompletion at Completions.scala(17,9) ================================================================================ [response] askTypeCompletion at (17,9) -retrieved 39 members +retrieved 37 members [inaccessible] private def privateM: String [inaccessible] private[this] val privateV: String [inaccessible] private[this] val protectedV: String @@ -22,10 +22,8 @@ def hashCode(): Int def toString(): String def →[B](y: B): (test.Compat.type, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean diff --git a/test/files/presentation/visibility.check b/test/files/presentation/visibility.check index 217da34b9c..1ae1213f2d 100644 --- a/test/files/presentation/visibility.check +++ b/test/files/presentation/visibility.check @@ -3,7 +3,7 @@ reload: Completions.scala askTypeCompletion at Completions.scala(14,12) ================================================================================ [response] askTypeCompletion at (14,12) -retrieved 37 members +retrieved 35 members [inaccessible] private[this] def secretPrivateThis(): Unit def +(other: String): String def ->[B](y: B): (accessibility.Foo, B) @@ -19,10 +19,8 @@ def someTests(other: accessibility.Foo): Unit def toString(): String def →[B](y: B): (accessibility.Foo, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean @@ -43,7 +41,7 @@ protected[package lang] def finalize(): Unit askTypeCompletion at Completions.scala(16,11) ================================================================================ [response] askTypeCompletion at (16,11) -retrieved 37 members +retrieved 35 members def +(other: String): String def ->[B](y: B): (accessibility.Foo, B) def ensuring(cond: Boolean): accessibility.Foo @@ -58,10 +56,8 @@ def someTests(other: accessibility.Foo): Unit def toString(): String def →[B](y: B): (accessibility.Foo, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean @@ -83,7 +79,7 @@ protected[package lang] def finalize(): Unit askTypeCompletion at Completions.scala(22,11) ================================================================================ [response] askTypeCompletion at (22,11) -retrieved 37 members +retrieved 35 members [inaccessible] private def secretPrivate(): Unit def +(other: String): String def ->[B](y: B): (accessibility.AccessibilityChecks, B) @@ -100,10 +96,8 @@ def someTests: Unit def toString(): String def →[B](y: B): (accessibility.AccessibilityChecks, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean @@ -123,7 +117,7 @@ protected[package lang] def finalize(): Unit askTypeCompletion at Completions.scala(28,10) ================================================================================ [response] askTypeCompletion at (28,10) -retrieved 37 members +retrieved 35 members [inaccessible] private def secretPrivate(): Unit [inaccessible] private[this] def secretPrivateThis(): Unit [inaccessible] protected def secretProtected(): Unit @@ -143,10 +137,8 @@ def someTests(other: accessibility.Foo): Unit def toString(): String def →[B](y: B): (accessibility.Foo, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean @@ -163,7 +155,7 @@ protected[package accessibility] def secretProtectedInPackage(): Unit askTypeCompletion at Completions.scala(37,8) ================================================================================ [response] askTypeCompletion at (37,8) -retrieved 37 members +retrieved 35 members [inaccessible] private def secretPrivate(): Unit [inaccessible] private[this] def secretPrivateThis(): Unit [inaccessible] protected def secretProtected(): Unit @@ -184,10 +176,8 @@ def someTests(other: accessibility.Foo): Unit def toString(): String def →[B](y: B): (accessibility.Foo, B) final def !=(x$1: Any): Boolean -final def !=(x$1: AnyRef): Boolean final def ##(): Int final def ==(x$1: Any): Boolean -final def ==(x$1: AnyRef): Boolean final def asInstanceOf[T0]: T0 final def eq(x$1: AnyRef): Boolean final def isInstanceOf[T0]: Boolean -- cgit v1.2.3