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 1
1
scala> List(null)
2
2
val 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] {
6
6
7
7
trait LowPrioShow {
8
8
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
10
10
}
11
11
}
12
12
@@ -16,8 +16,7 @@ object Show extends LowPrioShow {
16
16
* any `T`, we default to `T#toString`.
17
17
*/
18
18
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)
21
20
}
22
21
23
22
/** 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