Skip to content

Commit

Permalink
tryfix(16459): add more test cases
Browse files Browse the repository at this point in the history
I need to come up with good solution for pattern match with `if` guard.
  • Loading branch information
i10416 committed Jan 25, 2024
1 parent c8d7ca1 commit 3e83bde
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/run/i16459.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ object Test {
import scala.xml.*
def main(args: Array[String]): Unit = {

val xml = if(true) {
val singleQuotedTextCase = if(true) {
<script type="text/javascript">
'location.reload()'
'foo bar'
</script>
} else <div>empty</div>

val casePatMatch = for (case t @ <foo>FooBar</foo> <- Seq(xml))
yield t
// TODO: This fails
val casePatMatchWithCond = for (case t @ <foo>FooBar</foo> <- Seq(xml))
yield t

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

0 comments on commit 3e83bde

Please sign in to comment.