diff options
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 } + +} |