From 0c4a06f8409feac5ba99c0a8961210225dbd4936 Mon Sep 17 00:00:00 2001 From: liu fengyun Date: Thu, 6 Apr 2017 15:36:37 +0200 Subject: exhaustivity support for enums --- tests/patmat/enumColor.scala | 12 ++++++++++++ tests/patmat/patmat-indent.check | 2 +- tests/patmat/patmat-indent.scala | 2 +- tests/patmat/t6420.check | 2 +- tests/patmat/t7285.check | 2 +- tests/patmat/t7466.check | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 tests/patmat/enumColor.scala (limited to 'tests') diff --git a/tests/patmat/enumColor.scala b/tests/patmat/enumColor.scala new file mode 100644 index 000000000..60d610d0d --- /dev/null +++ b/tests/patmat/enumColor.scala @@ -0,0 +1,12 @@ + enum Color { + case Red, Green, Blue + } + + object Test { + def f(color: Color) = { + import Color._ + color match { + case Red | Green | Blue => + } + } +} diff --git a/tests/patmat/patmat-indent.check b/tests/patmat/patmat-indent.check index 79845ebcf..4f0ec4dd9 100644 --- a/tests/patmat/patmat-indent.check +++ b/tests/patmat/patmat-indent.check @@ -1,3 +1,3 @@ 9: Pattern Match Exhaustivity: Nil -23: Pattern Match Exhaustivity: _: Boolean +23: Pattern Match Exhaustivity: true, false 27: Pattern Match Exhaustivity: _: Int diff --git a/tests/patmat/patmat-indent.scala b/tests/patmat/patmat-indent.scala index ef25bb2c7..a2b18e7fb 100644 --- a/tests/patmat/patmat-indent.scala +++ b/tests/patmat/patmat-indent.scala @@ -1,5 +1,5 @@ object Test { - val Nil = scala.Nil + val Nil: scala.collection.immutable.Nil.type = scala.collection.immutable.Nil val X = 5 object Inner { diff --git a/tests/patmat/t6420.check b/tests/patmat/t6420.check index 73acf1454..c15701594 100644 --- a/tests/patmat/t6420.check +++ b/tests/patmat/t6420.check @@ -1 +1 @@ -5: Pattern Match Exhaustivity: (Nil, _), (List(_, _), _), (Nil, Nil), (Nil, List(_, _)), (List(_, _), Nil), (List(_, _), List(_, _)), (_, Nil), (_, List(_, _)) +5: Pattern Match Exhaustivity: (Nil, _), (List(true, _), _), (List(false, _), _), (_, Nil), (_, List(true, _)), (_, List(false, _)) diff --git a/tests/patmat/t7285.check b/tests/patmat/t7285.check index 1c2841920..d40b77e4b 100644 --- a/tests/patmat/t7285.check +++ b/tests/patmat/t7285.check @@ -1,3 +1,3 @@ 15: Pattern Match Exhaustivity: (Up, Down) 33: Pattern Match Exhaustivity: Down -51: Pattern Match Exhaustivity: (Base.Up, Base.Down) +51: Pattern Match Exhaustivity: (Up, Down) diff --git a/tests/patmat/t7466.check b/tests/patmat/t7466.check index 35227484e..af596399b 100644 --- a/tests/patmat/t7466.check +++ b/tests/patmat/t7466.check @@ -1 +1 @@ -8: Pattern Match Exhaustivity: (_, _) +8: Pattern Match Exhaustivity: (true, _), (false, _), (_, true), (_, false) -- cgit v1.2.3