summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-08-23 09:14:33 +0000
committerBurak Emir <emir@epfl.ch>2007-08-23 09:14:33 +0000
commit62cd29a17818625f9a0ec84ffdac827281ae6265 (patch)
tree1bf0f6fc977cb306085d62b7a0df549ac82d0785
parent1ce5ecc912833a4452e1de23c6bb2fd859d66bd4 (diff)
downloadscala-62cd29a17818625f9a0ec84ffdac827281ae6265.tar.gz
scala-62cd29a17818625f9a0ec84ffdac827281ae6265.tar.bz2
scala-62cd29a17818625f9a0ec84ffdac827281ae6265.zip
fix #1286
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternMatchers.scala8
-rw-r--r--test/files/run/patmatnew.scala4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
index 7880070f6e..74d654a267 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
@@ -267,7 +267,7 @@ trait PatternMatchers { self: transform.ExplicitOuter with PatternNodes with Par
} else {
isImplemented(xs, guard)
}
- case p @ Ident(n) => null // if(n!= nme.WILDCARD && p.symbol.) CantHandleIdent else null
+ case p @ Ident(n) => if(guard eq EmptyTree) null else CantHandleGuard
//case UnApply(fn,xs) => isImplemented(xs, guard)
case UnApply(fn,xs) =>
@@ -275,7 +275,7 @@ trait PatternMatchers { self: transform.ExplicitOuter with PatternNodes with Par
// List.unapply<...>(xs)
case Apply(TypeApply(sel @ Select(stor, nme.unapplySeq),_),_) if(stor.symbol eq definitions.ListModule) =>
(xs: @unchecked) match {
- case ArrayValue(_,ys)::Nil => return {if(guard eq EmptyTree) isImplemented(ys, guard) else CantHandleSeq }
+ case ArrayValue(_,ys)::Nil => return {if(guard eq EmptyTree) isImplemented(ys, guard) else CantHandleGuard }
}
// ignore other unapplySeq occurrences, since will run into ArrayValue
@@ -286,8 +286,8 @@ trait PatternMatchers { self: transform.ExplicitOuter with PatternNodes with Par
case Bind(n, p) => isImplemented(p , guard)
case Alternative(xs) => isImplemented(xs, guard)
case p:Literal => null
- case p:Select => null
- case p:Typed => null
+ case p:Select => if(guard eq EmptyTree) null else CantHandleGuard
+ case p:Typed => if(guard eq EmptyTree) null else CantHandleGuard
// ArrayValue nodes can also appear in repeated parameter positions of case classes (e.g. xml.Elem)
case ArrayValue(_,xs) => CantHandleSeq
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index 76395bd7e2..7c283fae5c 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -443,6 +443,10 @@ object Test extends TestConsoleMain {
z.isDefinedAt(42)
s.isDefinedAt(42)
// just load the thing, to see if the classes are found
+
+ (None:Option[Boolean]) match {
+ case x if x.map(x => x).isEmpty =>
+ }
}
}