@@ -2,18 +2,12 @@ object Test {
2
2
import scala .xml .*
3
3
def main (args : Array [String ]): Unit = {
4
4
5
- val singleQuotedTextCase = if (true ) {
5
+ val xml = if (true ) {
6
6
<script type =" text/javascript" >
7
7
' location .reload()'
8
8
' foo bar'
9
9
</script >
10
10
} 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
17
11
18
12
assert(
19
13
xml match
@@ -26,7 +20,45 @@ object Test {
26
20
,
27
21
xml
28
22
)
23
+ // Scala 3 syntax
24
+ val auxiliary0 = if true then {
25
+ <script type =" text/javascript" >
26
+ ' location .reload()'
27
+ ' foo bar'
28
+ </script >
29
+ } else <div >empty</div >
30
+
31
+ val auxiliary1 = if true then
32
+ <script type =" text/javascript" >
33
+ ' location .reload()'
34
+ ' foo bar'
35
+ </script >
36
+ else <div >empty</div >
37
+
38
+ val auxiliary2 = if true then <div >A </div >else <div >B </div >
39
+
40
+ // Note:
41
+ // This does not pass in Scala 2.12.18 and 2.13.12
42
+ // due to "Sequence argument type annotation `: _*` cannot be used here:"
43
+ val auxiliary3 = if (true ) <div >A </div >else <div >B </div >
44
+
45
+ // Note: This passes in Scala 2.12.18 and 2.13.12 too.
46
+ val auxiliary4 = if (true ) <div attr =" ..." >A </div >else <div attr =" ..." >B </div >
47
+
48
+ // Pattern match without guard.
49
+ // Note: This passes in Scala 2.12.18 and 2.13.12 too.
50
+ val auxiliary5 = for (case _ @ <div >empty</div > <- Seq (xml)) yield ()
51
+ val auxiliary6 = for (case _ @ <div >empty</div ><- Seq (xml)) yield ()
52
+ val auxiliary7 = for (case _ @ <div >empty</div ><- Seq (xml)) yield ()
53
+ // Pattern match with if guard.
54
+ // Note: This passes in Scala 2.12.18 and 2.13.12 too.
55
+ val auxiliary8 = for (case _ @ <foo >FooBar </foo > <- Seq (xml) if true )
56
+ val auxiliary9 = for (case _ @ <foo >FooBar </foo ><- Seq (xml) if true )
57
+ val auxiliary10 = for (case _ @ <foo >FooBar </foo ><- Seq (xml) if true )
58
+ yield ()
59
+
29
60
}
61
+
30
62
}
31
63
32
64
package scala .xml {
@@ -46,10 +78,7 @@ package scala.xml {
46
78
def child : Seq [Node ]
47
79
override def toString = label + child.mkString
48
80
}
49
- class Comment (commentText : String ) extends Node {
50
- def label = commentText
51
- def child = Nil
52
- }
81
+
53
82
class Elem (prefix : String , val label : String , attributes1 : MetaData , scope : NamespaceBinding , minimizeEmpty : Boolean , val child : Node * ) extends Node
54
83
object Elem {
55
84
def unapply (e: Elem ): Option [(String ,String ,Any ,Text ,Any )] = Some ((" dummy" ," dummy" ,null ,null ,null ))
0 commit comments