diff options
author | Som Snytt <som.snytt@gmail.com> | 2014-07-14 07:32:03 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2014-07-14 07:32:03 -0700 |
commit | b0dd01ebb4b0cc41a6629357522217bfe14821fb (patch) | |
tree | 775eeaf9386ed24024f028fe9a8f30640964bf55 /test/files/run/t8608-no-format.scala | |
parent | aea6519685561ee076e7fdaac48c2bf970389b83 (diff) | |
download | scala-b0dd01ebb4b0cc41a6629357522217bfe14821fb.tar.gz scala-b0dd01ebb4b0cc41a6629357522217bfe14821fb.tar.bz2 scala-b0dd01ebb4b0cc41a6629357522217bfe14821fb.zip |
SI-8608 f interpolator emits constant strings
When invoking `format` is obviated by a lack of
formatting fields, then just degenerate to an
unenhanced constant string.
This means it doesn't cost anything to use
f"$$ordinary" in place of "$ordinary", which
may cause warnings under -Xlint.
Note that certain format literals, in particular
for line separator %n, are not actually literals and
can't be replaced at compile time.
Diffstat (limited to 'test/files/run/t8608-no-format.scala')
-rw-r--r-- | test/files/run/t8608-no-format.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/files/run/t8608-no-format.scala b/test/files/run/t8608-no-format.scala new file mode 100644 index 0000000000..71c369a7ea --- /dev/null +++ b/test/files/run/t8608-no-format.scala @@ -0,0 +1,15 @@ + +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |f"hello, world" + |:javap -prv - + """.stripMargin + + // no format + override def yah(res: Seq[String]) = { + // note: avoid the word "information" + res forall (!_.contains("StringOps.format")) + } +} |