summaryrefslogtreecommitdiff
path: root/test/files/neg/t5762.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/files/neg/t5762.scala
parent9d423c9bb76dddcd080d98f4a05c02856708fc06 (diff)
downloadscala-9904301752c2aa8c8509f1bcd6108f626220524a.tar.gz
scala-9904301752c2aa8c8509f1bcd6108f626220524a.tar.bz2
scala-9904301752c2aa8c8509f1bcd6108f626220524a.zip
Additional new tests for unchecked warnings.
Diffstat (limited to 'test/files/neg/t5762.scala')
-rw-r--r--test/files/neg/t5762.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/files/neg/t5762.scala b/test/files/neg/t5762.scala
new file mode 100644
index 0000000000..fb73552b12
--- /dev/null
+++ b/test/files/neg/t5762.scala
@@ -0,0 +1,24 @@
+class D[-A]
+
+object Test {
+ var bippy: Boolean = true
+ def f1(x: D[Int with String]) = x match {
+ case _: D[Int] if bippy => 1
+ case _: D[String] => 2
+ }
+ // Correctly warns:
+ //
+ // a.scala:5: warning: non variable type-argument Int in type pattern D[Int] is unchecked since it is eliminated by erasure
+ // case _: D[Int] => 1
+ // ^
+ // a.scala:6: warning: non variable type-argument String in type pattern D[String] is unchecked since it is eliminated by erasure
+ // case _: D[String] => 2
+ // ^
+ // two warnings found
+
+ def f2(x: D[D[Int] with D[String]]) = x match {
+ case _: D[D[Int]] if bippy => 1
+ case _: D[D[String]] => 2
+ }
+ // No warnings!
+}