diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-02 03:09:22 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-02 03:09:22 -0700 |
commit | b0d70beb50e9d7946166f0218cf42bc1d9850754 (patch) | |
tree | 34c10b6d99e44a66a05a72f24d857fdb374c3ba5 /src/compiler | |
parent | d14d8178fa39961951d7dd74a37994db86a13063 (diff) | |
parent | a3315cdcf6ca2714e563eb813b645e267ba2ea5a (diff) | |
download | scala-b0d70beb50e9d7946166f0218cf42bc1d9850754.tar.gz scala-b0d70beb50e9d7946166f0218cf42bc1d9850754.tar.bz2 scala-b0d70beb50e9d7946166f0218cf42bc1d9850754.zip |
Merge pull request #798 from retronym/ticket/2807-4
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 a167180267..52cce11deb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4868,9 +4868,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 _ => } } |