summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-07-21 19:49:55 -0700
committerPaul Phillips <paulp@improving.org>2012-07-27 05:42:17 -0700
commitbc719cb8e4957a80e423350d8e993f1fa6a2a997 (patch)
tree2939e8688721c66fd1493bdadf9260d75faa4514 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parentad08f24448729009fc8d5ff0acf307a43b4cfe0a (diff)
downloadscala-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 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 51753baa4f..269ab9611a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3672,7 +3672,8 @@ trait Typers extends Modes with Adaptations with Tags {
typedClassOf(tree, args.head, true)
else {
if (!isPastTyper && fun.symbol == Any_isInstanceOf && !targs.isEmpty)
- checkCheckable(tree, targs.head, inPattern = false)
+ checkCheckable(tree, targs.head, AnyClass.tpe, inPattern = false)
+
val resultpe = restpe.instantiateTypeParams(tparams, targs)
//@M substitution in instantiateParams needs to be careful!
//@M example: class Foo[a] { def foo[m[x]]: m[a] = error("") } (new Foo[Int]).foo[List] : List[Int]