Skip to content

Commit 587f89d

Browse files
committed
Define a low-priority instance of Show for Product
This removes the need for some of the default instances. More importantly, this reduces the burden and boilerplate that would be needed when introducing a new case class, without defining a Show instance for it or extending Showable.
1 parent ae5c5a5 commit 587f89d

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

compiler/src/dotty/tools/dotc/printing/Formatting.scala

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ object Formatting {
3131
object ShowAny extends Show[Any]:
3232
def show(x: Any): Shown = x
3333

34-
class ShowImplicits1:
34+
class ShowImplicits2:
35+
given Show[Product] = ShowAny
36+
37+
class ShowImplicits1 extends ShowImplicits2:
3538
given Show[ImplicitRef] = ShowAny
3639
given Show[Names.Designator] = ShowAny
3740
given Show[util.SrcPos] = ShowAny
@@ -60,25 +63,15 @@ object Formatting {
6063
given Show[Class[?]] = ShowAny
6164
given Show[Exception] = ShowAny
6265
given Show[StringBuffer] = ShowAny
63-
given Show[Atoms] = ShowAny
64-
given Show[Highlight] = ShowAny
65-
given Show[HighlightBuffer] = ShowAny
6666
given Show[CompilationUnit] = ShowAny
67-
given Show[Mode] = ShowAny
6867
given Show[Phases.Phase] = ShowAny
69-
given Show[Signature] = ShowAny
7068
given Show[TyperState] = ShowAny
7169
given Show[config.ScalaVersion] = ShowAny
7270
given Show[io.AbstractFile] = ShowAny
73-
given Show[parsing.Scanners.IndentWidth] = ShowAny
7471
given Show[parsing.Scanners.Scanner] = ShowAny
7572
given Show[util.SourceFile] = ShowAny
7673
given Show[util.Spans.Span] = ShowAny
77-
given Show[dotty.tools.tasty.TastyBuffer.Addr] = ShowAny
7874
given Show[tasty.TreeUnpickler#OwnerTree] = ShowAny
79-
given Show[interactive.Completion] = ShowAny
80-
given Show[transform.sjs.JSSymUtils.JSName] = ShowAny
81-
given Show[org.scalajs.ir.Position] = ShowAny
8275
end Show
8376
end ShownDef
8477
export ShownDef.{ Show, Shown }

0 commit comments

Comments
 (0)