File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
compiler/test-resources/repl Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 11scala> List(null)
22val res0: List[Null] = List(null)
3+ scala> List[String](null)
4+ val res1: List[String] = List(null)
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ trait Show[T] {
66
77trait LowPrioShow {
88 implicit def defaultShow [T ]: Show [T ] = new Show [T ] {
9- def show (x : T ) = if (x == null ) " null " else x.toString
9+ def show (x : T ) = x.toString
1010 }
1111}
1212
@@ -16,8 +16,7 @@ object Show extends LowPrioShow {
1616 * any `T`, we default to `T#toString`.
1717 */
1818 implicit class ShowValue [V ](val v : V ) extends AnyVal {
19- def show (implicit ev : Show [V ]): String =
20- ev.show(v)
19+ def show (implicit ev : Show [V ]): String = if (v == null ) " null" else ev.show(v)
2120 }
2221
2322 /** Adds escaping backslashes in a string so that it could be put in source code.
You can’t perform that action at this time.
0 commit comments