diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-04 23:12:26 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-10-04 23:12:26 -0700 |
commit | 59d869f51aa555b03c13032a5d975d4e8e23bf8e (patch) | |
tree | 08c31ce50ecbfaa9fffeaf0f9a200cfa50e42b5c /test/files/pos/exhaust_2.scala | |
parent | 5e1cbba30766bd66e696175d08a013f74bcd0aff (diff) | |
parent | 5240da5073168424db50b969c1bbf7089d0a4242 (diff) | |
download | scala-59d869f51aa555b03c13032a5d975d4e8e23bf8e.tar.gz scala-59d869f51aa555b03c13032a5d975d4e8e23bf8e.tar.bz2 scala-59d869f51aa555b03c13032a5d975d4e8e23bf8e.zip |
Merge pull request #1467 from paulp/passing-tests
Move tests out of pending.
Diffstat (limited to 'test/files/pos/exhaust_2.scala')
-rw-r--r-- | test/files/pos/exhaust_2.scala | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/files/pos/exhaust_2.scala b/test/files/pos/exhaust_2.scala new file mode 100644 index 0000000000..4f4e47c43b --- /dev/null +++ b/test/files/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[_], _) => + } +} |