summaryrefslogtreecommitdiff
path: root/test/files/neg/forgot-interpolator.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-03-11 22:11:19 -0700
committerPaul Phillips <paulp@improving.org>2013-03-12 07:35:49 -0700
commit9fed30cb9c6d86ca07286febeb44bf635cb23650 (patch)
tree951a0edf356000b0cefbf6ffa49751848e948cd7 /test/files/neg/forgot-interpolator.scala
parenta41c79bb5b2f16d8f37e253737f67171e5764bb9 (diff)
downloadscala-9fed30cb9c6d86ca07286febeb44bf635cb23650.tar.gz
scala-9fed30cb9c6d86ca07286febeb44bf635cb23650.tar.bz2
scala-9fed30cb9c6d86ca07286febeb44bf635cb23650.zip
Warn about forgotten string interpolators.
In the compiler sources this arrives with a number of false positives, because we frequently work with strings containing $foo where foo is an in-scope identifier. I think in normal source code this will be less of a problem, or none at all; but to be conservative the warning is born under -Xlint.
Diffstat (limited to 'test/files/neg/forgot-interpolator.scala')
-rw-r--r--test/files/neg/forgot-interpolator.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/files/neg/forgot-interpolator.scala b/test/files/neg/forgot-interpolator.scala
new file mode 100644
index 0000000000..d67db82643
--- /dev/null
+++ b/test/files/neg/forgot-interpolator.scala
@@ -0,0 +1,15 @@
+class A {
+ val bippy = 123
+
+ def f = "Put the $bippy in the $bippy!" // warn
+}
+
+class B {
+ val dingus = 123
+
+ def f = "Put the $bippy in the $bippy!" // no warn
+}
+
+class C {
+ def f = """Put the ${println("bippy")} in the bippy!""" // warn
+}