diff options
-rw-r--r-- | src/library/scala/Proxy.scala | 4 | ||||
-rw-r--r-- | test/files/run/proxy.check | 4 | ||||
-rw-r--r-- | test/files/run/proxy.scala | 9 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/library/scala/Proxy.scala b/src/library/scala/Proxy.scala index 4c890c828d..18b08d55a2 100644 --- a/src/library/scala/Proxy.scala +++ b/src/library/scala/Proxy.scala @@ -25,6 +25,8 @@ import Predef._ trait Proxy { def self: Any override def hashCode: Int = self.hashCode - override def equals(that: Any): Boolean = that equals self + override def equals(that: Any): Boolean = + if(that == null) false + else that equals self override def toString: String = self.toString } diff --git a/test/files/run/proxy.check b/test/files/run/proxy.check new file mode 100644 index 0000000000..f311ce0361 --- /dev/null +++ b/test/files/run/proxy.check @@ -0,0 +1,4 @@ +false +true +false +false
\ No newline at end of file diff --git a/test/files/run/proxy.scala b/test/files/run/proxy.scala new file mode 100644 index 0000000000..d9c7bcf69f --- /dev/null +++ b/test/files/run/proxy.scala @@ -0,0 +1,9 @@ +object Test extends Application { + val p = new Proxy { + def self = 2 + } + println(p equals 1) + println(p equals 2) + println(p equals 3) + println(p equals null) +}
\ No newline at end of file |