From 6fc37a13242fc78d85138b32a803f8316a2b2040 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 24 May 2010 22:26:47 +0000 Subject: 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. --- src/library/scala/xml/NodeBuffer.scala | 3 ++- test/files/run/nodebuffer-array.check | 3 +++ test/files/run/nodebuffer-array.scala | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/files/run/nodebuffer-array.check create mode 100644 test/files/run/nodebuffer-array.scala 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 @@ + + abc + 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) = { + + { + for (item <- s split ',') yield + { item } + } + + } + + def main(args: Array[String]): Unit = { + println(f("a,b,c")) + } +} -- cgit v1.2.3