diff options
author | Martin Odersky <odersky@gmail.com> | 2008-07-10 16:54:35 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-07-10 16:54:35 +0000 |
commit | 9dc05dc520c149d97877526d651d40d9c31214e3 (patch) | |
tree | d76aa3e9b76df3006e6460314b2707392e1c27e4 /test/files/pos/t1059.scala | |
parent | 79727b4ea3c4e672d2f9ce64a167de47e8006d15 (diff) | |
download | scala-9dc05dc520c149d97877526d651d40d9c31214e3.tar.gz scala-9dc05dc520c149d97877526d651d40d9c31214e3.tar.bz2 scala-9dc05dc520c149d97877526d651d40d9c31214e3.zip |
fixed #764 and #770
Diffstat (limited to 'test/files/pos/t1059.scala')
-rwxr-xr-x | test/files/pos/t1059.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/files/pos/t1059.scala b/test/files/pos/t1059.scala new file mode 100755 index 0000000000..659bf375ca --- /dev/null +++ b/test/files/pos/t1059.scala @@ -0,0 +1,28 @@ +package com; + +import scala.xml._ + +object Main { + + def main(args : Array[String]) : Unit = { + + var m : PartialFunction[Any, Any] = { + + case SafeNodeSeq(s @ _*) => println(s) } + + println(m(<a/> ++ <b/>)) + println(m.isDefinedAt(<a/> ++ <b/>)) + + } + +} + +object SafeNodeSeq { + + def unapplySeq(any: Any) : Option[Seq[Node]] = any match { case s: Seq[_] => Some(s flatMap ( _ match { + + case n: Node => n case _ => NodeSeq.Empty + + })) case _ => None } + +} |