diff options
author | Paul Phillips <paulp@improving.org> | 2011-01-21 05:03:42 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-01-21 05:03:42 +0000 |
commit | e6167d9350b8f268379d0b4683400fb7950f0d13 (patch) | |
tree | 37205481d2b6c668877cd0ad7be8d1cf44c3bade | |
parent | 3715aa127c51cbcae87af34c088e013d56cb128f (diff) | |
download | scala-e6167d9350b8f268379d0b4683400fb7950f0d13.tar.gz scala-e6167d9350b8f268379d0b4683400fb7950f0d13.tar.bz2 scala-e6167d9350b8f268379d0b4683400fb7950f0d13.zip |
The empty string commit made me hungry to actua...
The empty string commit made me hungry to actually know what's in stuff.
Now it prints quotes around a string if it's empty or if either the
first or last character is whitespace. No review.
-rw-r--r-- | src/library/scala/runtime/ScalaRunTime.scala | 1 | ||||
-rw-r--r-- | test/files/jvm/interpreter.check | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index 5d1fad896a..956147ab4a 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -290,6 +290,7 @@ object ScalaRunTime { def inner(arg: Any): String = arg match { case null => "null" case "" => "\"\"" + case x: String => if (x.head.isWhitespace || x.last.isWhitespace) "\"" + x + "\"" else x case x if useOwnToString(x) => x.toString case x: AnyRef if isArray(x) => WrappedArray make x take maxElements map inner mkString ("Array(", ", ", ")") case x: collection.Map[_, _] => x take maxElements map mapInner mkString (x.stringPrefix + "(", ", ", ")") diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index 3955804db0..ce43875c36 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -198,10 +198,10 @@ scala> scala> scala> scala> | | | res9: java.lang.String = - +" hello there - +" scala> scala> | | You typed two blank lines. Starting a new command. |