summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-03-30 13:40:08 +0000
committerMartin Odersky <odersky@gmail.com>2007-03-30 13:40:08 +0000
commit098db0fd0bb6ad0ddf978b5fc719fa6a8c2954f0 (patch)
treefaf5798c666f5f810bb386f38314a7be04fe9b0b /src/compiler/scala/tools/nsc/ast/TreeInfo.scala
parent4b37b5a01cf94d9fde0c6d736082f34e5e09dced (diff)
downloadscala-098db0fd0bb6ad0ddf978b5fc719fa6a8c2954f0.tar.gz
scala-098db0fd0bb6ad0ddf978b5fc719fa6a8c2954f0.tar.bz2
scala-098db0fd0bb6ad0ddf978b5fc719fa6a8c2954f0.zip
fixed bug1024.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/TreeInfo.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeInfo.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
index d4ff2d1737..aba34b0d51 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
@@ -182,6 +182,15 @@ abstract class TreeInfo {
case _ => false
}
+ /** can this type be a type pattern */
+ def mayBeTypePat(tree: Tree): boolean = tree match {
+ case CompoundTypeTree(Template(tps, List())) => tps exists mayBeTypePat
+ case Annotated(_, tp) => mayBeTypePat(tp)
+ case AppliedTypeTree(constr, args) => mayBeTypePat(constr) || args.exists(.isInstanceOf[Bind])
+ case SelectFromTypeTree(tp, _) => mayBeTypePat(tp)
+ case _ => false
+ }
+
/** Is this pattern node a catch-all (wildcard or variable) pattern? */
def isDefaultCase(cdef: CaseDef) = cdef match {
case CaseDef(Ident(nme.WILDCARD), EmptyTree, _) => true