File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -53,19 +53,23 @@ private[repl] class Rendering(compiler: ReplCompiler,
5353 val resObj : Class [_] = Class .forName(objectName, true , classLoader())
5454 val value =
5555 resObj
56- .getDeclaredMethods.find(_.getName == sym.name.encode.toString).get
57- .invoke(null )
58- val string = value match {
59- case null => " null" // Calling .toString on null => NPE
60- case " " => " \"\" " // Sepcial cased for empty string, following scalac
61- case x => x.toString
56+ .getDeclaredMethods.find(_.getName == sym.name.encode.toString)
57+ .map(_.invoke(null ))
58+ val string = value.map {
59+ case null => " null" // Calling .toString on null => NPE
60+ case " " => " \"\" " // Special cased for empty string, following scalac
61+ case a : Array [_] => a.mkString(" Array(" , " , " , " )" )
62+ case x => x.toString
6263 }
6364 if (! sym.is(Flags .Method ) && sym.info == defn.UnitType )
6465 None
65- else if (string.startsWith(str.REPL_SESSION_LINE ))
66- Some (string.drop(str.REPL_SESSION_LINE .length).dropWhile(c => c.isDigit || c == '$' ))
6766 else
68- Some (string)
67+ string.map { s =>
68+ if (s.startsWith(str.REPL_SESSION_LINE ))
69+ s.drop(str.REPL_SESSION_LINE .length).dropWhile(c => c.isDigit || c == '$' )
70+ else
71+ s
72+ }
6973 }
7074
7175 /** Render method definition result */
Original file line number Diff line number Diff line change 1+ scala> val a = Array(1, 2, 3)
2+ val a: Array[Int] = Array(1, 2, 3)
You can’t perform that action at this time.
0 commit comments