summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-05-24 22:26:47 +0000
committerPaul Phillips <paulp@improving.org>2010-05-24 22:26:47 +0000
commit6fc37a13242fc78d85138b32a803f8316a2b2040 (patch)
tree0c21f9606ac9a7b692cec94fb500d9269a780eaf
parenta3c413084cccde5c7a3dec510971f9ef8fbf628f (diff)
downloadscala-6fc37a13242fc78d85138b32a803f8316a2b2040.tar.gz
scala-6fc37a13242fc78d85138b32a803f8316a2b2040.tar.bz2
scala-6fc37a13242fc78d85138b32a803f8316a2b2040.zip
Fixed an xml issue arising from arrays no longe...
Fixed an xml issue arising from arrays no longer being recognized as sequences. Review by dpp.
-rw-r--r--src/library/scala/xml/NodeBuffer.scala3
-rw-r--r--test/files/run/nodebuffer-array.check3
-rw-r--r--test/files/run/nodebuffer-array.scala15
3 files changed, 20 insertions, 1 deletions
diff --git a/src/library/scala/xml/NodeBuffer.scala b/src/library/scala/xml/NodeBuffer.scala
index 3498f1664f..e9c82b0451 100644
--- a/src/library/scala/xml/NodeBuffer.scala
+++ b/src/library/scala/xml/NodeBuffer.scala
@@ -38,9 +38,10 @@ class NodeBuffer extends scala.collection.mutable.ArrayBuffer[Node] {
def &+(o: Any): NodeBuffer = {
o match {
case null | _: Unit | Text("") => // ignore
- case it: Iterator[_] => it foreach (this &+ _)
+ case it: Iterator[_] => it foreach &+
case n: Node => super.+=(n)
case ns: Iterable[_] => this &+ ns.iterator
+ case ns: Array[_] => this &+ ns.iterator
case d => super.+=(new Atom(d))
}
this
diff --git a/test/files/run/nodebuffer-array.check b/test/files/run/nodebuffer-array.check
new file mode 100644
index 0000000000..49f8bfaf8d
--- /dev/null
+++ b/test/files/run/nodebuffer-array.check
@@ -0,0 +1,3 @@
+<entry>
+ <elem>a</elem><elem>b</elem><elem>c</elem>
+ </entry>
diff --git a/test/files/run/nodebuffer-array.scala b/test/files/run/nodebuffer-array.scala
new file mode 100644
index 0000000000..f9cfbc50df
--- /dev/null
+++ b/test/files/run/nodebuffer-array.scala
@@ -0,0 +1,15 @@
+object Test {
+
+ def f(s: String) = {
+ <entry>
+ {
+ for (item <- s split ',') yield
+ <elem>{ item }</elem>
+ }
+ </entry>
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f("a,b,c"))
+ }
+}