aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--library/src/dotty/Show.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/library/src/dotty/Show.scala b/library/src/dotty/Show.scala
index 36327b834..2febda0e7 100644
--- a/library/src/dotty/Show.scala
+++ b/library/src/dotty/Show.scala
@@ -8,10 +8,13 @@ trait Show[-T] {
}
object Show {
+ private[this] val defaultShow = new Show[Any] {
+ def show(x: Any) = x.toString
+ }
+
implicit class ShowValue[V](val v: V) extends AnyVal {
- def show(implicit ev: Show[V] = null): String =
- if (ev != null) ev.show(v)
- else v.toString
+ def show(implicit ev: Show[V] = defaultShow): String =
+ ev.show(v)
}
implicit val stringShow = new Show[String] {