diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-23 02:42:06 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-23 02:42:06 -0700 |
commit | cebf241ad87358b0e8d2804750a4ac36e76f7091 (patch) | |
tree | 29e04607f5bf666bed4f8d78d1b757f0763fdd1e /test/files/neg | |
parent | 2e7daa10097246c03df1f77aebc85f1ecdebb7e9 (diff) | |
parent | 3f7b8b58748eb70aec4269f1ef63853b5ad4af60 (diff) | |
download | scala-cebf241ad87358b0e8d2804750a4ac36e76f7091.tar.gz scala-cebf241ad87358b0e8d2804750a4ac36e76f7091.tar.bz2 scala-cebf241ad87358b0e8d2804750a4ac36e76f7091.zip |
Merge pull request #601 from adriaanm/3f7b8b58748eb70aec4269f1ef63853b5ad4af60
virtpatmat: treemaker approximation refactorings and exhaustivity
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/exhausting.check | 34 | ||||
-rw-r--r-- | test/files/neg/exhausting.flags | 2 | ||||
-rw-r--r-- | test/files/neg/exhausting.scala | 26 | ||||
-rw-r--r-- | test/files/neg/pat_unreachable.flags | 2 | ||||
-rw-r--r-- | test/files/neg/patmatexhaust.check | 55 | ||||
-rw-r--r-- | test/files/neg/patmatexhaust.flags | 2 | ||||
-rw-r--r-- | test/files/neg/patmatexhaust.scala | 2 | ||||
-rw-r--r-- | test/files/neg/sealed-java-enums.check | 8 | ||||
-rw-r--r-- | test/files/neg/sealed-java-enums.flags | 2 | ||||
-rw-r--r-- | test/files/neg/switch.check | 6 | ||||
-rw-r--r-- | test/files/neg/switch.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t3098.check | 5 | ||||
-rw-r--r-- | test/files/neg/t3098.flags | 2 | ||||
-rw-r--r-- | test/files/neg/t3683a.check | 5 | ||||
-rw-r--r-- | test/files/neg/t3683a.flags | 2 | ||||
-rw-r--r-- | test/files/neg/t3692-new.flags | 2 | ||||
-rw-r--r-- | test/files/neg/t3692-old.flags | 2 |
17 files changed, 75 insertions, 83 deletions
diff --git a/test/files/neg/exhausting.check b/test/files/neg/exhausting.check index 0bef21e077..7140b99428 100644 --- a/test/files/neg/exhausting.check +++ b/test/files/neg/exhausting.check @@ -1,29 +1,25 @@ -exhausting.scala:20: error: match is not exhaustive! -missing combination * Nil - +exhausting.scala:21: error: match may not be exhaustive. +It would fail on the following input: List(_, _, _) def fail1[T](xs: List[T]) = xs match { ^ -exhausting.scala:24: error: match is not exhaustive! -missing combination Nil - +exhausting.scala:27: error: match may not be exhaustive. +It would fail on the following input: Nil def fail2[T](xs: List[T]) = xs match { ^ -exhausting.scala:27: error: match is not exhaustive! -missing combination Bar3 - +exhausting.scala:32: error: match may not be exhaustive. +It would fail on the following input: List(<not in (1, 2)>) + def fail3a(xs: List[Int]) = xs match { + ^ +exhausting.scala:39: error: match may not be exhaustive. +It would fail on the following input: Bar3 def fail3[T](x: Foo[T]) = x match { ^ -exhausting.scala:31: error: match is not exhaustive! -missing combination Bar2 Bar2 - +exhausting.scala:47: error: match may not be exhaustive. +It would fail on the following inputs: (Bar1, Bar2), (Bar1, Bar3), (Bar2, Bar1), (Bar2, Bar2) def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match { ^ -exhausting.scala:36: error: match is not exhaustive! -missing combination Bar1 Bar2 -missing combination Bar1 Bar3 -missing combination Bar2 Bar1 -missing combination Bar2 Bar2 - +exhausting.scala:56: error: match may not be exhaustive. +It would fail on the following inputs: (Bar1, Bar2), (Bar1, Bar3), (Bar2, Bar1), (Bar2, Bar2) def fail5[T](xx: (Foo[T], Foo[T])) = xx match { ^ -5 errors found +6 errors found diff --git a/test/files/neg/exhausting.flags b/test/files/neg/exhausting.flags index b7eb21d5f5..85d8eb2ba2 100644 --- a/test/files/neg/exhausting.flags +++ b/test/files/neg/exhausting.flags @@ -1 +1 @@ --Xfatal-warnings -Xoldpatmat +-Xfatal-warnings diff --git a/test/files/neg/exhausting.scala b/test/files/neg/exhausting.scala index 14b05695aa..5554ee2671 100644 --- a/test/files/neg/exhausting.scala +++ b/test/files/neg/exhausting.scala @@ -16,30 +16,46 @@ object Test { def ex3[T](xx: (Foo[T], Foo[T])) = xx match { case (_: Foo[_], _: Foo[_]) => () } - + + // fails for: ::(_, ::(_, ::(_, _))) def fail1[T](xs: List[T]) = xs match { case Nil => "ok" case x :: y :: Nil => "ok" } + + // fails for: Nil def fail2[T](xs: List[T]) = xs match { case _ :: _ => "ok" } + + // fails for: ::(<not in (2, 1)>, _) + def fail3a(xs: List[Int]) = xs match { + case 1 :: _ => + case 2 :: _ => + case Nil => + } + + // fails for: Bar3 def fail3[T](x: Foo[T]) = x match { case Bar1 => "ok" case Bar2 => "ok" } + // fails for: (Bar1, Bar2) + // fails for: (Bar1, Bar3) + // fails for: (Bar2, Bar2) + // fails for: (Bar2, Bar1) def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match { case (Bar1, Bar1) => () case (Bar2, Bar3) => () case (Bar3, _) => () } + // fails for: (Bar1, Bar2) + // fails for: (Bar1, Bar3) + // fails for: (Bar2, Bar1) + // fails for: (Bar2, Bar2) def fail5[T](xx: (Foo[T], Foo[T])) = xx match { case (Bar1, Bar1) => () case (Bar2, Bar3) => () case (Bar3, _) => () } - - def main(args: Array[String]): Unit = { - - } } diff --git a/test/files/neg/pat_unreachable.flags b/test/files/neg/pat_unreachable.flags index ba80cad69b..cb8324a345 100644 --- a/test/files/neg/pat_unreachable.flags +++ b/test/files/neg/pat_unreachable.flags @@ -1 +1 @@ --Xoldpatmat +-Xoldpatmat
\ No newline at end of file diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check index 5426d61d31..6172811e13 100644 --- a/test/files/neg/patmatexhaust.check +++ b/test/files/neg/patmatexhaust.check @@ -1,54 +1,41 @@ -patmatexhaust.scala:7: error: match is not exhaustive! -missing combination Baz - +patmatexhaust.scala:7: error: match may not be exhaustive. +It would fail on the following input: Baz def ma1(x:Foo) = x match { ^ -patmatexhaust.scala:11: error: match is not exhaustive! -missing combination Bar - +patmatexhaust.scala:11: error: match may not be exhaustive. +It would fail on the following input: Bar(_) def ma2(x:Foo) = x match { ^ -patmatexhaust.scala:23: error: match is not exhaustive! -missing combination Kult Kult -missing combination Qult Qult - +patmatexhaust.scala:23: error: match may not be exhaustive. +It would fail on the following inputs: (Kult(_), Kult(_)), (Qult(), Qult()) def ma3(x:Mult) = (x,x) match { // not exhaustive ^ -patmatexhaust.scala:49: error: match is not exhaustive! -missing combination Gp -missing combination Gu - +patmatexhaust.scala:49: error: match may not be exhaustive. +It would fail on the following inputs: Gp(), Gu def ma4(x:Deep) = x match { // missing cases: Gu, Gp ^ -patmatexhaust.scala:53: error: match is not exhaustive! -missing combination Gp - - def ma5(x:Deep) = x match { // Gp +patmatexhaust.scala:53: error: match may not be exhaustive. +It would fail on the following input: Gp() + def ma5(x:Deep) = x match { ^ -patmatexhaust.scala:59: error: match is not exhaustive! -missing combination Nil - +patmatexhaust.scala:59: error: match may not be exhaustive. +It would fail on the following input: Nil def ma6() = List(1,2) match { // give up ^ -patmatexhaust.scala:75: error: match is not exhaustive! -missing combination B - +patmatexhaust.scala:75: error: match may not be exhaustive. +It would fail on the following input: B() def ma9(x: B) = x match { ^ -patmatexhaust.scala:100: error: match is not exhaustive! -missing combination C1 - +patmatexhaust.scala:100: error: match may not be exhaustive. +It would fail on the following input: C1() def ma10(x: C) = x match { // not exhaustive: C1 is not sealed. ^ -patmatexhaust.scala:114: error: match is not exhaustive! -missing combination D1 -missing combination D2 - +patmatexhaust.scala:114: error: match may not be exhaustive. +It would fail on the following inputs: D1, D2() def ma10(x: C) = x match { // not exhaustive: C1 has subclasses. ^ -patmatexhaust.scala:126: error: match is not exhaustive! -missing combination C1 - +patmatexhaust.scala:126: error: match may not be exhaustive. +It would fail on the following input: C1() def ma10(x: C) = x match { // not exhaustive: C1 is not abstract. ^ 10 errors found diff --git a/test/files/neg/patmatexhaust.flags b/test/files/neg/patmatexhaust.flags index b7eb21d5f5..85d8eb2ba2 100644 --- a/test/files/neg/patmatexhaust.flags +++ b/test/files/neg/patmatexhaust.flags @@ -1 +1 @@ --Xfatal-warnings -Xoldpatmat +-Xfatal-warnings diff --git a/test/files/neg/patmatexhaust.scala b/test/files/neg/patmatexhaust.scala index 9297e09d0d..ceb960ee97 100644 --- a/test/files/neg/patmatexhaust.scala +++ b/test/files/neg/patmatexhaust.scala @@ -50,7 +50,7 @@ class TestSealedExhaustive { // compile only case Ga => } - def ma5(x:Deep) = x match { // Gp + def ma5(x:Deep) = x match { case Gu => case _ if 1 == 0 => case Ga => diff --git a/test/files/neg/sealed-java-enums.check b/test/files/neg/sealed-java-enums.check index 9303c2df9c..20d00c8e91 100644 --- a/test/files/neg/sealed-java-enums.check +++ b/test/files/neg/sealed-java-enums.check @@ -1,9 +1,5 @@ -sealed-java-enums.scala:5: error: match is not exhaustive! -missing combination BLOCKED -missing combination State -missing combination TERMINATED -missing combination TIMED_WAITING - +sealed-java-enums.scala:5: error: match may not be exhaustive. +It would fail on the following inputs: BLOCKED, TERMINATED, TIMED_WAITING def f(state: State) = state match { ^ one error found diff --git a/test/files/neg/sealed-java-enums.flags b/test/files/neg/sealed-java-enums.flags index 312f3a87ec..e709c65918 100644 --- a/test/files/neg/sealed-java-enums.flags +++ b/test/files/neg/sealed-java-enums.flags @@ -1 +1 @@ --Xexperimental -Xfatal-warnings -Xoldpatmat +-Xexperimental -Xfatal-warnings diff --git a/test/files/neg/switch.check b/test/files/neg/switch.check index 7212c1a22b..8955c94b32 100644 --- a/test/files/neg/switch.check +++ b/test/files/neg/switch.check @@ -1,10 +1,10 @@ switch.scala:28: error: could not emit switch for @switch annotated match def fail1(c: Char) = (c: @switch) match { - ^ + ^ switch.scala:38: error: could not emit switch for @switch annotated match def fail2(c: Char) = (c: @switch @unchecked) match { - ^ + ^ switch.scala:45: error: could not emit switch for @switch annotated match def fail3(c: Char) = (c: @unchecked @switch) match { - ^ + ^ three errors found diff --git a/test/files/neg/switch.flags b/test/files/neg/switch.flags deleted file mode 100644 index 809e9ff2f2..0000000000 --- a/test/files/neg/switch.flags +++ /dev/null @@ -1 +0,0 @@ - -Xoldpatmat diff --git a/test/files/neg/t3098.check b/test/files/neg/t3098.check index 403da281c8..85829747b9 100644 --- a/test/files/neg/t3098.check +++ b/test/files/neg/t3098.check @@ -1,6 +1,5 @@ -b.scala:3: error: match is not exhaustive! -missing combination C - +b.scala:3: error: match may not be exhaustive. +It would fail on the following input: (_ : C) def f = (null: T) match { ^ one error found diff --git a/test/files/neg/t3098.flags b/test/files/neg/t3098.flags index b7eb21d5f5..85d8eb2ba2 100644 --- a/test/files/neg/t3098.flags +++ b/test/files/neg/t3098.flags @@ -1 +1 @@ --Xfatal-warnings -Xoldpatmat +-Xfatal-warnings diff --git a/test/files/neg/t3683a.check b/test/files/neg/t3683a.check index 18e80dd5e8..3de3ad784e 100644 --- a/test/files/neg/t3683a.check +++ b/test/files/neg/t3683a.check @@ -1,6 +1,5 @@ -t3683a.scala:14: error: match is not exhaustive! -missing combination XX - +t3683a.scala:14: error: match may not be exhaustive. +It would fail on the following input: XX() w match { ^ one error found diff --git a/test/files/neg/t3683a.flags b/test/files/neg/t3683a.flags index b7eb21d5f5..85d8eb2ba2 100644 --- a/test/files/neg/t3683a.flags +++ b/test/files/neg/t3683a.flags @@ -1 +1 @@ --Xfatal-warnings -Xoldpatmat +-Xfatal-warnings diff --git a/test/files/neg/t3692-new.flags b/test/files/neg/t3692-new.flags index 82becdfbfd..cb8324a345 100644 --- a/test/files/neg/t3692-new.flags +++ b/test/files/neg/t3692-new.flags @@ -1 +1 @@ - -Xoldpatmat
\ No newline at end of file +-Xoldpatmat
\ No newline at end of file diff --git a/test/files/neg/t3692-old.flags b/test/files/neg/t3692-old.flags index 82becdfbfd..cb8324a345 100644 --- a/test/files/neg/t3692-old.flags +++ b/test/files/neg/t3692-old.flags @@ -1 +1 @@ - -Xoldpatmat
\ No newline at end of file +-Xoldpatmat
\ No newline at end of file |