summaryrefslogtreecommitdiff
path: root/test/pending/pos/exhaust_2.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-25 18:14:49 -0700
committerPaul Phillips <paulp@improving.org>2012-09-25 18:21:42 -0700
commit9904301752c2aa8c8509f1bcd6108f626220524a (patch)
tree2c970440d0cd6e070f3d0ae1ffd961020330755a /test/pending/pos/exhaust_2.scala
parent9d423c9bb76dddcd080d98f4a05c02856708fc06 (diff)
downloadscala-9904301752c2aa8c8509f1bcd6108f626220524a.tar.gz
scala-9904301752c2aa8c8509f1bcd6108f626220524a.tar.bz2
scala-9904301752c2aa8c8509f1bcd6108f626220524a.zip
Additional new tests for unchecked warnings.
Diffstat (limited to 'test/pending/pos/exhaust_2.scala')
-rw-r--r--test/pending/pos/exhaust_2.scala54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/pending/pos/exhaust_2.scala b/test/pending/pos/exhaust_2.scala
new file mode 100644
index 0000000000..4f4e47c43b
--- /dev/null
+++ b/test/pending/pos/exhaust_2.scala
@@ -0,0 +1,54 @@
+object ExhaustivityWarnBugReportMinimal {
+ //sealed is needed for the warning
+ sealed trait FoundNode[T]/*presence of parameters is irrelevant*/
+ // This also causes a warning:
+ // sealed abstract class FoundNode[T]/*presence of parameters is irrelevant*/
+ case class FoundFilter[T](/*presence of parameters is irrelevant*/) extends FoundNode[T]
+ case class FoundTypeCase[T](/*presence of parameters is irrelevant*/) extends FoundNode[T]
+ val f: Some[_] = ???
+ f match {
+ case x: Some[t] => //no warning
+ }
+ //With these variants, no warnings:
+ //val v: (Some[Int], FoundNode[_]) = (???, ???)
+ //val v: (Some[AnyRef], FoundNode[_]) = (???, ???)
+ //val v: (Some[String], FoundNode[_]) = (???, ???)
+
+ val v: (Some[_], FoundNode[_]) = (???, ???)
+ //Warning here:
+ v match {
+ case (x: Some[t], _: FoundNode[_]) =>
+ }
+ v match {
+ case (x: Some[t], _) =>
+ }
+
+ v match {
+ case (x: Some[_], _) =>
+ }
+ case class Foo[T]()
+
+ val vp: (Foo[_], FoundNode[_]) = (???, ???)
+ vp match {
+ case (x: Foo[_], _) =>
+ }
+
+ //No warning here:
+ v match {
+ case (Some(y), _) =>
+ }
+
+ v match {
+ case (x, _) =>
+ }
+
+ val v2: (Some[_], Int) = (???, ???)
+ v2 match {
+ case (x: Some[t], _) =>
+ }
+
+ val v3: (Option[_], FoundNode[_]) = (???, ???)
+ v match {
+ case (x: Option[_], _) =>
+ }
+}