From a8edefcef8905ed3487c7293056f6d0946e79dd7 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Wed, 20 Mar 2013 16:09:04 +0100 Subject: SI-7271 fixes positions of string interpolation parts Positions of static parts are now set explicitly during parsing rather than filled in wholesale during subsequent atPos after parsing. I also had to change the offsets that scanner uses for initial static parts of string interpolations so that they no longer point to the opening double quote, but rather to the actual beginning of the part. --- test/files/run/t7271.scala | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/files/run/t7271.scala (limited to 'test/files/run/t7271.scala') diff --git a/test/files/run/t7271.scala b/test/files/run/t7271.scala new file mode 100644 index 0000000000..6fccf14d20 --- /dev/null +++ b/test/files/run/t7271.scala @@ -0,0 +1,34 @@ +import scala.tools.partest._ +import java.io._ +import scala.tools.nsc._ +import scala.tools.nsc.util.CommandLineParser +import scala.tools.nsc.{Global, Settings, CompilerCommand} +import scala.tools.nsc.reporters.ConsoleReporter + +object Test extends DirectTest { + + override def extraSettings: String = "-usejavacp -Xprint:parser -Ystop-after:parser -d " + testOutput.path + + override def code = """ + class C { + def quote = s"foo${this}baz" + def tripleQuote = s"foo${this}baz" + } + """.trim + + override def show(): Unit = { + // redirect err to out, for logging + val prevErr = System.err + System.setErr(System.out) + compile() + System.setErr(prevErr) + } + + override def newCompiler(args: String*): Global = { + + val settings = new Settings() + settings.Xprintpos.value = true + val command = new CompilerCommand((CommandLineParser tokenize extraSettings) ++ args.toList, settings) + new Global(command.settings, new ConsoleReporter(settings)) with interactive.RangePositions + } +} -- cgit v1.2.3