summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-19 21:19:25 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-11-26 22:29:26 +0100
commit0271a4a3944153bb4fcc81e3b250bc084b692db3 (patch)
treece1748ebff2d90db1fdccd60b8b6bab58f1b55e0 /test
parent7cd50ba39c332c39990bc3a7103e1f86b040032e (diff)
downloadscala-0271a4a3944153bb4fcc81e3b250bc084b692db3.tar.gz
scala-0271a4a3944153bb4fcc81e3b250bc084b692db3.tar.bz2
scala-0271a4a3944153bb4fcc81e3b250bc084b692db3.zip
SI-7984 Issue unchecked warning for type aliases
- Dealias pattern types before launching the CheckabilityChecker - Sharpen the error messages to explain that the dealiased type is the expansion of the alias.
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t3692-new.check6
-rw-r--r--test/files/neg/t7984.check6
-rw-r--r--test/files/neg/t7984.flags1
-rw-r--r--test/files/neg/t7984.scala7
-rw-r--r--test/files/neg/unchecked-suppress.check4
-rw-r--r--test/files/neg/unchecked.check6
-rw-r--r--test/files/neg/unchecked3.check2
7 files changed, 23 insertions, 9 deletions
diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check
index 9b96449930..bb8692f3ca 100644
--- a/test/files/neg/t3692-new.check
+++ b/test/files/neg/t3692-new.check
@@ -1,10 +1,10 @@
-t3692-new.scala:14: warning: non-variable type argument Int in type pattern Map[Int,Int] is unchecked since it is eliminated by erasure
+t3692-new.scala:14: warning: non-variable type argument Int in type pattern scala.collection.immutable.Map[Int,Int] (the underlying of Map[Int,Int]) is unchecked since it is eliminated by erasure
case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer]
^
-t3692-new.scala:15: warning: non-variable type argument Int in type pattern Map[Int,V] is unchecked since it is eliminated by erasure
+t3692-new.scala:15: warning: non-variable type argument Int in type pattern scala.collection.immutable.Map[Int,V] (the underlying of Map[Int,V]) is unchecked since it is eliminated by erasure
case m1: Map[Int, V] => new java.util.HashMap[Integer, V]
^
-t3692-new.scala:16: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure
+t3692-new.scala:16: warning: non-variable type argument Int in type pattern scala.collection.immutable.Map[T,Int] (the underlying of Map[T,Int]) is unchecked since it is eliminated by erasure
case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
^
t3692-new.scala:15: warning: unreachable code
diff --git a/test/files/neg/t7984.check b/test/files/neg/t7984.check
new file mode 100644
index 0000000000..0cfd7d1619
--- /dev/null
+++ b/test/files/neg/t7984.check
@@ -0,0 +1,6 @@
+t7984.scala:4: warning: non-variable type argument Int in type pattern List[Int] (the underlying of Test.this.ListInt) is unchecked since it is eliminated by erasure
+ case is: ListInt => is.head
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t7984.flags b/test/files/neg/t7984.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t7984.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7984.scala b/test/files/neg/t7984.scala
new file mode 100644
index 0000000000..ca09a89fc7
--- /dev/null
+++ b/test/files/neg/t7984.scala
@@ -0,0 +1,7 @@
+class Test {
+ type ListInt = List[Int]
+ List[Any]("") match {
+ case is: ListInt => is.head
+ case _ =>
+ }
+}
diff --git a/test/files/neg/unchecked-suppress.check b/test/files/neg/unchecked-suppress.check
index 038105918e..d3dc86014b 100644
--- a/test/files/neg/unchecked-suppress.check
+++ b/test/files/neg/unchecked-suppress.check
@@ -1,7 +1,7 @@
-unchecked-suppress.scala:4: warning: non-variable type argument Int in type pattern Set[Int] is unchecked since it is eliminated by erasure
+unchecked-suppress.scala:4: warning: non-variable type argument Int in type pattern scala.collection.immutable.Set[Int] (the underlying of Set[Int]) is unchecked since it is eliminated by erasure
case xs: Set[Int] => xs.head // unchecked
^
-unchecked-suppress.scala:5: warning: non-variable type argument String in type pattern Map[String @unchecked,String] is unchecked since it is eliminated by erasure
+unchecked-suppress.scala:5: warning: non-variable type argument String in type pattern scala.collection.immutable.Map[String @unchecked,String] (the underlying of Map[String @unchecked,String]) is unchecked since it is eliminated by erasure
case xs: Map[String @unchecked, String] => xs.head // one unchecked, one okay
^
unchecked-suppress.scala:7: warning: non-variable type argument Int in type pattern (Int, Int) => Int is unchecked since it is eliminated by erasure
diff --git a/test/files/neg/unchecked.check b/test/files/neg/unchecked.check
index 570f02f219..033cffb18f 100644
--- a/test/files/neg/unchecked.check
+++ b/test/files/neg/unchecked.check
@@ -1,10 +1,10 @@
-unchecked.scala:18: warning: non-variable type argument String in type pattern Iterable[String] is unchecked since it is eliminated by erasure
+unchecked.scala:18: warning: non-variable type argument String in type pattern Iterable[String] (the underlying of Iterable[String]) is unchecked since it is eliminated by erasure
case xs: Iterable[String] => xs.head // unchecked
^
-unchecked.scala:22: warning: non-variable type argument Any in type pattern Set[Any] is unchecked since it is eliminated by erasure
+unchecked.scala:22: warning: non-variable type argument Any in type pattern scala.collection.immutable.Set[Any] (the underlying of Set[Any]) is unchecked since it is eliminated by erasure
case xs: Set[Any] => xs.head // unchecked
^
-unchecked.scala:26: warning: non-variable type argument Any in type pattern Map[Any,Any] is unchecked since it is eliminated by erasure
+unchecked.scala:26: warning: non-variable type argument Any in type pattern scala.collection.immutable.Map[Any,Any] (the underlying of Map[Any,Any]) is unchecked since it is eliminated by erasure
case xs: Map[Any, Any] => xs.head // unchecked
^
unchecked.scala:35: warning: non-variable type argument List[Nothing] in type pattern Test.Contra[List[Nothing]] is unchecked since it is eliminated by erasure
diff --git a/test/files/neg/unchecked3.check b/test/files/neg/unchecked3.check
index a7582a8930..0a526050fc 100644
--- a/test/files/neg/unchecked3.check
+++ b/test/files/neg/unchecked3.check
@@ -31,7 +31,7 @@ unchecked3.scala:62: warning: non-variable type argument Array[String] in type p
unchecked3.scala:63: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure
/* warn */ case _: Array[Array[List[String]]] => ()
^
-unchecked3.scala:75: warning: abstract type A in type pattern Set[Q.this.A] is unchecked since it is eliminated by erasure
+unchecked3.scala:75: warning: abstract type A in type pattern scala.collection.immutable.Set[Q.this.A] (the underlying of Set[Q.this.A]) is unchecked since it is eliminated by erasure
/* warn */ case xs: Set[A] => xs.head
^
unchecked3.scala:62: warning: unreachable code