From 3e83bdecbacb69ead9ddba09e127b13cf1e595af Mon Sep 17 00:00:00 2001 From: i10416 Date: Fri, 26 Jan 2024 02:54:13 +0900 Subject: [PATCH] tryfix(16459): add more test cases I need to come up with good solution for pattern match with `if` guard. --- tests/run/i16459.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/run/i16459.scala b/tests/run/i16459.scala index 627efc554de9..a0bb791f758e 100644 --- a/tests/run/i16459.scala +++ b/tests/run/i16459.scala @@ -2,12 +2,18 @@ object Test { import scala.xml.* def main(args: Array[String]): Unit = { - val xml = if(true) { + val singleQuotedTextCase = if(true) { } else
empty
+ + val casePatMatch = for (case t @ FooBar <- Seq(xml)) + yield t + // TODO: This fails + val casePatMatchWithCond = for (case t @ FooBar <- Seq(xml)) + yield t assert( xml match @@ -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 {