diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-06-30 09:13:05 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-06-30 09:13:05 +0200 |
commit | a3315cdcf6ca2714e563eb813b645e267ba2ea5a (patch) | |
tree | 1c8b36ad1385ef8a397b0752b2bc9fc08b9c3c52 /src/compiler | |
parent | cd1e6f94e92f2c8fc79aa3c76b1e3b813182e2d3 (diff) | |
download | scala-a3315cdcf6ca2714e563eb813b645e267ba2ea5a.tar.gz scala-a3315cdcf6ca2714e563eb813b645e267ba2ea5a.tar.bz2 scala-a3315cdcf6ca2714e563eb813b645e267ba2ea5a.zip |
SI-2807 Avoid catch all warning for Stable Id patterns
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index d251109dc4..25857773fe 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4865,9 +4865,10 @@ trait Typers extends Modes with Adaptations with Tags { for (cdef <- catches1 if cdef.guard.isEmpty) { def warn(name: Name) = context.warning(cdef.pat.pos, s"This catches all Throwables. If this is really intended, use `case ${name.decoded} : Throwable` to clear this warning.") + def unbound(t: Tree) = t.symbol == null || t.symbol == NoSymbol cdef.pat match { - case Bind(name, Ident(_)) => warn(name) - case Ident(name) => warn(name) + case Bind(name, i@Ident(_)) if unbound(i) => warn(name) + case i@Ident(name) if unbound(i) => warn(name) case _ => } } |