diff --git a/tests/run/i16459.scala b/tests/run/i16459.scala index dd4cf14fbc88..2eee132ecd2c 100644 --- a/tests/run/i16459.scala +++ b/tests/run/i16459.scala @@ -2,18 +2,12 @@ object Test { import scala.xml.* def main(args: Array[String]): Unit = { - val singleQuotedTextCase = if(true) { + val xml = if(true) { } else
empty
- - val casePatMatch = for (case t @ FooBar <- Seq(xml)) - yield t - // TODO: This fails - val casePatMatchWithCond = for (case t @ FooBar if true <- Seq(xml)) - yield t assert( xml match @@ -26,7 +20,47 @@ object Test { , xml ) + // Scala 3 syntax + val auxiliary0 = if true then { + + } else
empty
+ + val auxiliary1 = if true then + + else
empty
+ + val auxiliary2 = if true then
A
else
B
+ + // Note: + // This does not pass in Scala 2.12.18 and 2.13.12 + // due to "Sequence argument type annotation `: _*` cannot be used here:" + val auxiliary3 = if(true)
A
else
B
+ + // Note: This passes in Scala 2.12.18 and 2.13.12 too. + val auxiliary4 = if(true)
A
else
B
+ + // Pattern match without guard. + // Note: This passes in Scala 2.12.18 and 2.13.12 too. + val auxiliary5 = for (case _ @
empty
<- Seq(xml)) yield () + // Note: These pass in Scala 2.12.18 and 2.13.12. + val auxiliary6 = for (case _ @
empty
<- Seq(xml)) yield () + val auxiliary7 = for (case _ @
empty
<-Seq(xml)) yield () + // Pattern match with if guard. + // Note: This passes in Scala 2.12.18 and 2.13.12 too. + val auxiliary8 = for (case _ @ FooBar <- Seq(xml) if true) + // Note: These pass in Scala 2.12.18 and 2.13.12. + val auxiliary9 = for (case _ @ FooBar<- Seq(xml) if true) + val auxiliary10 = for (case _ @ FooBar<-Seq(xml) if true) + yield () + } + } package scala.xml { @@ -46,10 +80,7 @@ package scala.xml { def child: Seq[Node] override def toString = label + child.mkString } - class Comment(commentText: String) extends Node{ - def label = commentText - 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))