Commit f716ea6
committed
Use
In `<a><b/><c/><a>`, a `NodeBuffer` (which extends `ArrayBuffer`) is
used to accumulate the children. The buffer is passed to
`new Elem($buf: _*)`, which only works thanks to the implicit
`collection.Seq[Node] => NodeSeq` declared in scala-xml.
With `-Vprint:typer`:
```scala
scala> <a><b/></a>
[[syntax trees at end of typer]] // rs$line$1
val res0: scala.xml.Elem =
{
new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null,
scala.xml.TopScope, false,
{
val $buf: scala.xml.NodeBuffer = new _root_.scala.xml.NodeBuffer()
$buf.&+(
{
{
new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null,
scala.xml.TopScope, true, [ : scala.xml.Node]*)
}
}
)
scala.xml.NodeSeq.seqToNodeSeq($buf)
}*
)
}
```
The implicit was not inserted in 2.12 because the varargs parameter of
Elem accepted a `collection.Seq`.toVector` for XML literal sequences1 parent d5ca220 commit f716ea6
File tree
2 files changed
+15
-7
lines changed- compiler/src/dotty/tools/dotc/parsing/xml
- tests/run
2 files changed
+15
-7
lines changedLines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | | - | |
65 | | - | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | | - | |
| 70 | + | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
| |||
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| |||
166 | 170 | | |
167 | 171 | | |
168 | 172 | | |
169 | | - | |
| 173 | + | |
170 | 174 | | |
171 | 175 | | |
172 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
0 commit comments