From f2ca54217ba191faad8945b208e6cc965796159d Mon Sep 17 00:00:00 2001 From: Aleksander Boruch-Gruszecki Date: Sat, 12 Aug 2017 16:07:28 +0200 Subject: [PATCH] Print Lists consistently in exhaustivity warnings --- compiler/src/dotty/tools/dotc/transform/patmat/Space.scala | 2 +- tests/patmat/exhausting.check | 2 +- tests/patmat/t4408.check | 2 +- tests/patmat/t5440.check | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala index b1d1d77215ba..4810929822ea 100644 --- a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala +++ b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala @@ -661,7 +661,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic { else if (scalaListType.isRef(sym)) if (mergeList) "_*" else "_: List" else if (scalaConsType.isRef(sym)) - if (mergeList) "_" else "List(_)" + if (mergeList) "_, _*" else "List(_, _*)" else if (tp.classSymbol.is(CaseClass) && !hasCustomUnapply(tp.classSymbol)) // use constructor syntax for case class showType(tp) + signature(tp).map(_ => "_").mkString("(", ", ", ")") diff --git a/tests/patmat/exhausting.check b/tests/patmat/exhausting.check index 6cb6db364892..51d2272add39 100644 --- a/tests/patmat/exhausting.check +++ b/tests/patmat/exhausting.check @@ -1,4 +1,4 @@ -21: Pattern Match Exhaustivity: List(_), List(_, _, _) +21: Pattern Match Exhaustivity: List(_), List(_, _, _, _*) 27: Pattern Match Exhaustivity: Nil 32: Pattern Match Exhaustivity: List(_, _*) 39: Pattern Match Exhaustivity: Bar3 diff --git a/tests/patmat/t4408.check b/tests/patmat/t4408.check index 2bd8b583f551..c8f296e85367 100644 --- a/tests/patmat/t4408.check +++ b/tests/patmat/t4408.check @@ -1 +1 @@ -2: Pattern Match Exhaustivity: List(_, _, _) +2: Pattern Match Exhaustivity: List(_, _, _, _*) diff --git a/tests/patmat/t5440.check b/tests/patmat/t5440.check index 511fcc6b44f0..7c04baaa0d81 100644 --- a/tests/patmat/t5440.check +++ b/tests/patmat/t5440.check @@ -1 +1 @@ -2: Pattern Match Exhaustivity: (Nil, List(_)), (List(_), Nil) +2: Pattern Match Exhaustivity: (Nil, List(_, _*)), (List(_, _*), Nil)