Skip to content

Commit 0423862

Browse files
committed
tryfix(16459): add more test cases
I need to come up with good solution for pattern match with `if` guard.
1 parent c8d7ca1 commit 0423862

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/run/i16459.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ object Test {
22
import scala.xml.*
33
def main(args: Array[String]): Unit = {
44

5-
val xml = if(true) {
5+
val singleQuotedTextCase = if(true) {
66
<script type="text/javascript">
77
'location.reload()'
88
'foo bar'
99
</script>
1010
} else <div>empty</div>
11+
12+
val casePatMatch = for (case t @ <foo>FooBar</foo> <- Seq(xml))
13+
yield t
14+
// TODO: This fails
15+
val casePatMatchWithCond = for (case t @ <foo>FooBar</foo> if true <- Seq(xml))
16+
yield t
1117

1218
assert(
1319
xml match
@@ -45,6 +51,9 @@ package scala.xml {
4551
def child = Nil
4652
}
4753
class Elem(prefix: String, val label: String, attributes1: MetaData, scope: NamespaceBinding, minimizeEmpty: Boolean, val child: Node*) extends Node
54+
object Elem {
55+
def unapply(e:Elem):Option[(String,String,Any,Text,Any)] = Some(("dummy","dummy",null,null,null))
56+
}
4857
class NodeBuffer extends Seq[Node] {
4958
val nodes = scala.collection.mutable.ArrayBuffer.empty[Node]
5059
def &+(o: Any): NodeBuffer = o match {

0 commit comments

Comments
 (0)