From 4df81aab315e587d9c7e319c7a2ece0f0f6fbaf3 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Sat, 20 Dec 2014 02:28:44 -0800 Subject: SI-3368 CDATA gets a Node XML Parser uses `scala.xml.PCData`. A compiler flag `-Yxml:coalescing`, analogous to `DocumentBuilderFactory.setCoalescing`, turns `PCData` nodes into `Text` nodes and coalesces sibling text nodes. This change also fixes parse errors such as rejecting a sequence of CDATA sections. A sequence of "top level" nodes are not coalesced. ``` scala> startworldstuff res0: scala.xml.Elem = startworldstuff scala> :replay -Yxml:coalescing Replaying: startworldstuff res0: scala.xml.Elem = starthi & byeworldstuffred & black ``` --- test/files/run/t3368.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/files/run/t3368.scala (limited to 'test/files/run/t3368.scala') diff --git a/test/files/run/t3368.scala b/test/files/run/t3368.scala new file mode 100644 index 0000000000..aaf34b43fb --- /dev/null +++ b/test/files/run/t3368.scala @@ -0,0 +1,18 @@ + +import scala.tools.partest.ParserTest + + +object Test extends ParserTest { + + override def code = """ + trait X { + // error: in XML literal: name expected, but char '!' cannot start a name + def x = + } + trait Y { + def y = startworldstuff + } + """ + + override def extraSettings = s"${super.extraSettings} -Yxml:coalescing" +} -- cgit v1.2.3