summaryrefslogtreecommitdiff
path: root/test/pending
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-09-28 04:46:02 -0700
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-09-28 04:46:02 -0700
commit57db28c55c3610f508b07940f7077cb73932418f (patch)
tree70b62aa01670cfc4b0877327a96e9d434f152418 /test/pending
parent0614d2f512ad7b1b3885f81d9e6e779f447a6511 (diff)
parent211c9620ba83de143ea4776f55a3e0c4de11d002 (diff)
downloadscala-57db28c55c3610f508b07940f7077cb73932418f.tar.gz
scala-57db28c55c3610f508b07940f7077cb73932418f.tar.bz2
scala-57db28c55c3610f508b07940f7077cb73932418f.zip
Merge pull request #1399 from paulp/210-unchecked
Much better unchecked warnings.
Diffstat (limited to 'test/pending')
-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[_], _) =>
+ }
+}