diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-26 08:38:00 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-26 10:35:22 -0700 |
commit | 17b409b7832f541e3d52d2776c8ff3c47574ae0f (patch) | |
tree | d3863c488d4c68b2f5f58d657db3f420b75b075e /test | |
parent | 43bf1ea07ccf4ccf5a63743e322d4b64320fc1c1 (diff) | |
download | scala-17b409b7832f541e3d52d2776c8ff3c47574ae0f.tar.gz scala-17b409b7832f541e3d52d2776c8ff3c47574ae0f.tar.bz2 scala-17b409b7832f541e3d52d2776c8ff3c47574ae0f.zip |
Restored warning for impossible type tests.
I had this in before, then removed it since it is sometimes
redundant with an error message later issued by the pattern
matcher (e.g. scrutinee is incompatible with pattern type.)
However it also catches a lot of cases which are not errors,
so I think the modest redundancy is tolerable for now.
I also enhanced the logic for recognizing impossible
type tests, taking sealedness into account.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/unchecked2.check | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/files/neg/unchecked2.check b/test/files/neg/unchecked2.check index 0ff2a249a8..b4a14358c7 100644 --- a/test/files/neg/unchecked2.check +++ b/test/files/neg/unchecked2.check @@ -1,22 +1,22 @@ -unchecked2.scala:4: error: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure +unchecked2.scala:4: error: fruitless type test: a Some[List[Int]] can never be a Option[List[String]] (but still might match its erasure) /* warn */ Some(List(1)).isInstanceOf[Option[List[String]]] ^ unchecked2.scala:5: error: non-variable type argument Option[_] in type Option[Option[_]] is unchecked since it is eliminated by erasure /* warn */ Some(123).isInstanceOf[Option[Option[_]]] ^ -unchecked2.scala:6: error: non-variable type argument String in type Option[String] is unchecked since it is eliminated by erasure +unchecked2.scala:6: error: fruitless type test: a Some[Int] can never be a Option[String] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[String]] ^ -unchecked2.scala:7: error: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure +unchecked2.scala:7: error: fruitless type test: a Some[Int] can never be a Option[List[String]] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[List[String]]] ^ -unchecked2.scala:8: error: non-variable type argument List[Int => String] in type Option[List[Int => String]] is unchecked since it is eliminated by erasure +unchecked2.scala:8: error: fruitless type test: a Some[Int] can never be a Option[List[Int => String]] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[List[Int => String]]] ^ -unchecked2.scala:9: error: non-variable type argument (String, Double) in type Option[(String, Double)] is unchecked since it is eliminated by erasure +unchecked2.scala:9: error: fruitless type test: a Some[Int] can never be a Option[(String, Double)] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[(String, Double)]] ^ -unchecked2.scala:10: error: non-variable type argument String => Double in type Option[String => Double] is unchecked since it is eliminated by erasure +unchecked2.scala:10: error: fruitless type test: a Some[Int] can never be a Option[String => Double] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[String => Double]] ^ unchecked2.scala:14: error: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure |