summaryrefslogtreecommitdiff
path: root/test/files/run/t6507.check
diff options
context:
space:
mode:
authorAntoine Gourlay <antoine@gourlay.fr>2013-08-16 17:22:18 +0200
committerAntoine Gourlay <antoine@gourlay.fr>2013-08-16 17:22:18 +0200
commit6db8a523e32c093c70b27797628bacbda78b81bb (patch)
tree496138c6840e8f999d02b6c11e05ef128b938fc0 /test/files/run/t6507.check
parentf17fb5eaa545490c761acd4f6979a619f919ac86 (diff)
downloadscala-6db8a523e32c093c70b27797628bacbda78b81bb.tar.gz
scala-6db8a523e32c093c70b27797628bacbda78b81bb.tar.bz2
scala-6db8a523e32c093c70b27797628bacbda78b81bb.zip
SI-6507 do not call .toString on REPL results when :silent is on.
Member handlers used to always call .toString on REPL results, even when :silent was on, which could force evaluation or cause unwanted side effects. This forwards the current value of `printResults` to the member handlers (through Request) for them to decide what to do when the results must not be printed. 2 handlers now do not return any extraction code when silent: - ValHandler, so that it doesn't call toString on the val - Assign, so that it doesn't call toString on the right-hand side of the assignement.
Diffstat (limited to 'test/files/run/t6507.check')
-rw-r--r--test/files/run/t6507.check26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/run/t6507.check b/test/files/run/t6507.check
new file mode 100644
index 0000000000..336db0aeaf
--- /dev/null
+++ b/test/files/run/t6507.check
@@ -0,0 +1,26 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> :silent
+Switched off result printing.
+
+scala> class A { override def toString() = { println("!"); "A" } }
+
+scala> val a = new A
+
+scala> var b: A = new A
+
+scala> b = new A
+
+scala> new A
+
+scala> :silent
+Switched on result printing.
+
+scala> res0
+!
+res1: A = A
+
+scala>