diff options
author | Martin Odersky <odersky@gmail.com> | 2007-07-03 16:50:24 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-07-03 16:50:24 +0000 |
commit | e4bc488dea80c032497e2f9cd0165da1b779dc9e (patch) | |
tree | 87463a8b7c79ffcb5abb72b73272aaba4cde43cc /src/compiler/scala/tools/nsc/ast/TreeInfo.scala | |
parent | 72597908f803fbf709bf8af8379ca10c7cfd7639 (diff) | |
download | scala-e4bc488dea80c032497e2f9cd0165da1b779dc9e.tar.gz scala-e4bc488dea80c032497e2f9cd0165da1b779dc9e.tar.bz2 scala-e4bc488dea80c032497e2f9cd0165da1b779dc9e.zip |
fixed bug 1192, 1168, plus a problem with exist...
fixed bug 1192, 1168, plus a problem with existentials
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/TreeInfo.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeInfo.scala | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala index af98036536..20ea71baba 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala @@ -205,12 +205,22 @@ abstract class TreeInfo { /** Is this pattern node a catch-all or type-test pattern? */ def isCatchCase(cdef: CaseDef) = cdef match { - case CaseDef(Typed(Ident(nme.WILDCARD), tpt), EmptyTree, _) => isSimple(tpt.tpe) - case CaseDef(Bind(_, Typed(Ident(nme.WILDCARD), tpt)), EmptyTree, _) => isSimple(tpt.tpe) - case _ => isDefaultCase(cdef) + case CaseDef(Typed(Ident(nme.WILDCARD), tpt), EmptyTree, _) => + isSimpleThrowable(tpt.tpe) + case CaseDef(Bind(_, Typed(Ident(nme.WILDCARD), tpt)), EmptyTree, _) => + isSimpleThrowable(tpt.tpe) + case _ => + isDefaultCase(cdef) + } + + private def isSimpleThrowable(tp: Type): boolean = tp match { + case TypeRef(pre, sym, args) => + (pre == NoPrefix || pre.widen.symbol.isStatic) && + (sym isNonBottomSubClass definitions.ThrowableClass) + case _ => + false } - private def isSimple(tp: Type): boolean = true /* If we have run-time types, and these are used for pattern matching, we should replace this by something like: |