From 22ea67733dd01466750bb9e6e4401e3e4385bdc3 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]. --- 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 43cac17e6318..a36e6f48533a 100644 --- a/compiler/src/dotty/tools/dotc/printing/Formatting.scala +++ b/compiler/src/dotty/tools/dotc/printing/Formatting.scala @@ -76,6 +76,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)}"))