diff options
author | Paul Phillips <paulp@improving.org> | 2012-07-21 19:49:55 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-07-27 05:42:17 -0700 |
commit | bc719cb8e4957a80e423350d8e993f1fa6a2a997 (patch) | |
tree | 2939e8688721c66fd1493bdadf9260d75faa4514 /test/files/neg/unchecked.check | |
parent | ad08f24448729009fc8d5ff0acf307a43b4cfe0a (diff) | |
download | scala-bc719cb8e4957a80e423350d8e993f1fa6a2a997.tar.gz scala-bc719cb8e4957a80e423350d8e993f1fa6a2a997.tar.bz2 scala-bc719cb8e4957a80e423350d8e993f1fa6a2a997.zip |
Improve unchecked warnings a lot.
Don't warn on "uncheckable" type patterns if they can be
statically guaranteed, regardless of their runtime checkability.
This covers patterns like Seq[Any] and lots more.
Review by @adriaanm.
Diffstat (limited to 'test/files/neg/unchecked.check')
-rw-r--r-- | test/files/neg/unchecked.check | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/files/neg/unchecked.check b/test/files/neg/unchecked.check new file mode 100644 index 0000000000..34a11db1a0 --- /dev/null +++ b/test/files/neg/unchecked.check @@ -0,0 +1,19 @@ +unchecked.scala:18: error: non-variable type argument String in type pattern Iterable[String] is unchecked since it is eliminated by erasure + case xs: Iterable[String] => xs.head // unchecked + ^ +unchecked.scala:22: error: non-variable type argument Any in type pattern Set[Any] is unchecked since it is eliminated by erasure + case xs: Set[Any] => xs.head // unchecked + ^ +unchecked.scala:26: error: non-variable type argument Any in type pattern Map[Any,Any] is unchecked since it is eliminated by erasure + case xs: Map[Any, Any] => xs.head // unchecked + ^ +unchecked.scala:35: error: non-variable type argument List[Nothing] in type pattern Test.Contra[List[Nothing]] is unchecked since it is eliminated by erasure + case xs: Contra[List[Nothing]] => xs.head // unchecked + ^ +unchecked.scala:50: error: non-variable type argument String in type pattern Test.Exp[String] is unchecked since it is eliminated by erasure + case ArrayApply(x: Exp[Array[T]], _, j: Exp[String]) => x // unchecked + ^ +unchecked.scala:55: error: non-variable type argument Array[T] in type pattern Test.Exp[Array[T]] is unchecked since it is eliminated by erasure + case ArrayApply(x: Exp[Array[T]], _, _) => x // unchecked + ^ +6 errors found |