From 62702259200b658f8684a441e294d25b3e476acf Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Sun, 25 Aug 2024 16:24:39 +0100 Subject: [PATCH] Implement Show[Seq[Nothing]] Somehow I hit this requirement, and it picked two other instances and calling them ambiguous, because it was looking for a Show[Nothing]. [Cherry-picked 22ea67733dd01466750bb9e6e4401e3e4385bdc3] --- compiler/src/dotty/tools/dotc/printing/Formatting.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/src/dotty/tools/dotc/printing/Formatting.scala b/compiler/src/dotty/tools/dotc/printing/Formatting.scala index 54434b2b0ca9..3ae903f04a23 100644 --- a/compiler/src/dotty/tools/dotc/printing/Formatting.scala +++ b/compiler/src/dotty/tools/dotc/printing/Formatting.scala @@ -74,6 +74,9 @@ object Formatting { given [X: Show]: Show[Seq[X]] with def show(x: Seq[X]) = CtxShow(x.map(toStr)) + given Show[Seq[Nothing]] with + def show(x: Seq[Nothing]) = CtxShow(x) + given [K: Show, V: Show]: Show[Map[K, V]] with def show(x: Map[K, V]) = CtxShow(x.map((k, v) => s"${toStr(k)} => ${toStr(v)}"))