From 4793c7bafac6c900d8044108a263f6967da871ee Mon Sep 17 00:00:00 2001 From: Aleksandar Prokopec Date: Thu, 24 May 2012 18:22:57 +0200 Subject: Fixes SI-5428. --- .../scala/collection/mutable/StackProxy.scala | 5 ++++ test/files/run/t5428.check | 1 + test/files/run/t5428.scala | 29 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 test/files/run/t5428.check create mode 100644 test/files/run/t5428.scala diff --git a/src/library/scala/collection/mutable/StackProxy.scala b/src/library/scala/collection/mutable/StackProxy.scala index 8884f03bbd..9eadfe4045 100644 --- a/src/library/scala/collection/mutable/StackProxy.scala +++ b/src/library/scala/collection/mutable/StackProxy.scala @@ -54,6 +54,11 @@ trait StackProxy[A] extends Stack[A] with Proxy { this } + override def push(elem: A): this.type = { + self.push(elem) + this + } + /** Returns the top element of the stack. This method will not remove * the element from the stack. An error is signaled if there is no * element on the stack. diff --git a/test/files/run/t5428.check b/test/files/run/t5428.check new file mode 100644 index 0000000000..7b4b1d6558 --- /dev/null +++ b/test/files/run/t5428.check @@ -0,0 +1 @@ +Stack(8, 7, 6, 5, 4, 3) \ No newline at end of file diff --git a/test/files/run/t5428.scala b/test/files/run/t5428.scala new file mode 100644 index 0000000000..106bb7fc31 --- /dev/null +++ b/test/files/run/t5428.scala @@ -0,0 +1,29 @@ + + + +import collection.mutable.{Stack, StackProxy} + + + +class A extends StackProxy[Int] { + val self = Stack[Int]() +} + + +object Test { + + def main(args: Array[String]) { + val a = new A + + a push 3 + a push 4 + a push 5 + + a.push(6, 7, 8) + + println(a) + + a pop + } + +} -- cgit v1.2.3