diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/Interpreter.scala | 3 | ||||
-rw-r--r-- | test/files/run/interpreter.check | 8 | ||||
-rw-r--r-- | test/files/run/interpreter.scala | 7 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index 09b8c6f068..99606e856f 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -627,8 +627,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) { ".asInstanceOf[AnyRef] != null) " + " { val tmp = " + req.fullPath(vname) + - // Cast to Any to avoid ambiguity in choice of toString - ".asInstanceOf[Any].toString(); " + + ".toString(); " + " (if(tmp.contains('\\n')) \"\\n\" else \"\") + tmp + \"\\n\"} else \"null\\n\") ") } } diff --git a/test/files/run/interpreter.check b/test/files/run/interpreter.check index 64eeca14ba..313a817968 100644 --- a/test/files/run/interpreter.check +++ b/test/files/run/interpreter.check @@ -37,9 +37,11 @@ scala> scala> atom: scala.xml.Atom[Unit] = () scala> -scala> defined class S - -scala> fish: S = fish +scala> +scala> +scala> +scala> +scala> arr: Array[java.lang.String] = Array(What's, up, doc?) scala> scala> diff --git a/test/files/run/interpreter.scala b/test/files/run/interpreter.scala index 1ebe72ed2a..dbfffd70d3 100644 --- a/test/files/run/interpreter.scala +++ b/test/files/run/interpreter.scala @@ -25,8 +25,11 @@ println("hello") // ambiguous toString problem from #547 val atom = new scala.xml.Atom() // overriding toString problem from #1404 -class S(override val toString : String) -val fish = new S("fish") +// commented out because the fix had to be reverted for arrays +//class S(override val toString : String) +//val fish = new S("fish") +// Test that arrays pretty print nicely. +val arr = Array("What's", "up", "doc?") // implicit conversions case class Foo(n: Int) |