Skip to content

Commit 9ee1734

Browse files
authored
Merge pull request #3003 from AleksanderBG/consistent-list-printing
Print Lists consistently in exhaustivity warnings
2 parents 84eda81 + f2ca542 commit 9ee1734

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
661661
else if (scalaListType.isRef(sym))
662662
if (mergeList) "_*" else "_: List"
663663
else if (scalaConsType.isRef(sym))
664-
if (mergeList) "_" else "List(_)"
664+
if (mergeList) "_, _*" else "List(_, _*)"
665665
else if (tp.classSymbol.is(CaseClass) && !hasCustomUnapply(tp.classSymbol))
666666
// use constructor syntax for case class
667667
showType(tp) + signature(tp).map(_ => "_").mkString("(", ", ", ")")

tests/patmat/exhausting.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
21: Pattern Match Exhaustivity: List(_), List(_, _, _)
1+
21: Pattern Match Exhaustivity: List(_), List(_, _, _, _*)
22
27: Pattern Match Exhaustivity: Nil
33
32: Pattern Match Exhaustivity: List(_, _*)
44
39: Pattern Match Exhaustivity: Bar3

tests/patmat/t4408.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2: Pattern Match Exhaustivity: List(_, _, _)
1+
2: Pattern Match Exhaustivity: List(_, _, _, _*)

tests/patmat/t5440.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2: Pattern Match Exhaustivity: (Nil, List(_)), (List(_), Nil)
1+
2: Pattern Match Exhaustivity: (Nil, List(_, _*)), (List(_, _*), Nil)

0 commit comments

Comments
 (0)