summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2014-12-03 15:58:19 -0800
committerSom Snytt <som.snytt@gmail.com>2014-12-03 16:38:50 -0800
commitdb8d5476537902760d33d29839afd813ff369ac8 (patch)
tree506989530c1805ad62ea4b21d851fcb1cf97372c /test
parent1810ac0bf47dcc40cc858f7a3c64356614f98110 (diff)
downloadscala-db8d5476537902760d33d29839afd813ff369ac8.tar.gz
scala-db8d5476537902760d33d29839afd813ff369ac8.tar.bz2
scala-db8d5476537902760d33d29839afd813ff369ac8.zip
SI-9027 Parser eagerly consumes space on multi XML elements
Once the parser starts looking for more <elements>, it should still lookahead speculatively, leaving any remaining whitespace, including newlines, after the last element.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/t9027.check19
-rw-r--r--test/files/run/t9027.scala15
2 files changed, 34 insertions, 0 deletions
diff --git a/test/files/run/t9027.check b/test/files/run/t9027.check
new file mode 100644
index 0000000000..3429254286
--- /dev/null
+++ b/test/files/run/t9027.check
@@ -0,0 +1,19 @@
+{
+ {
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, true));
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true));
+ $buf
+ };
+ println("hello, world.")
+}
+{
+ {
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, true));
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true));
+ $buf.$amp$plus(new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true));
+ $buf
+ };
+ println("hello, world.")
+}
diff --git a/test/files/run/t9027.scala b/test/files/run/t9027.scala
new file mode 100644
index 0000000000..26238147da
--- /dev/null
+++ b/test/files/run/t9027.scala
@@ -0,0 +1,15 @@
+
+// used to be parsed as .println
+object Test extends App {
+ import reflect.runtime._, universe._
+
+ val trees = List(
+ q"""<a/><b/>
+ println("hello, world.")""",
+ q"""<a/>
+ <b/>
+ <c/>
+ println("hello, world.")"""
+ )
+ trees foreach println
+}