diff options
author | Paul Phillips <paulp@improving.org> | 2012-07-13 12:08:20 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-07-13 12:08:20 -0700 |
commit | 453b7068ed4294eef18bf10a321a5b63497c7466 (patch) | |
tree | 8cfc64ec934fdf15d7665208a366611ce9474855 /test/files/neg/stringinterpolation_macro-neg.scala | |
parent | 724b0dc71f1f8f91b995d01e9e027789f54ecdfe (diff) | |
parent | 3d0099dbc990ab914de5b9deb5087d9d3fb6220c (diff) | |
download | scala-453b7068ed4294eef18bf10a321a5b63497c7466.tar.gz scala-453b7068ed4294eef18bf10a321a5b63497c7466.tar.bz2 scala-453b7068ed4294eef18bf10a321a5b63497c7466.zip |
Merge branch '2.10.x' into topic/name-implicits
Diffstat (limited to 'test/files/neg/stringinterpolation_macro-neg.scala')
-rw-r--r-- | test/files/neg/stringinterpolation_macro-neg.scala | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/files/neg/stringinterpolation_macro-neg.scala b/test/files/neg/stringinterpolation_macro-neg.scala new file mode 100644 index 0000000000..ac9d97d678 --- /dev/null +++ b/test/files/neg/stringinterpolation_macro-neg.scala @@ -0,0 +1,31 @@ +object Test extends App { + val s = "Scala" + val d = 8 + val b = false + val f = 3.14159 + + // 1) number of arguments + new StringContext().f() + new StringContext("", " is ", "%2d years old").f(s) + new StringContext("", " is ", "%2d years old").f(s, d, d) + new StringContext("", "").f() + + // 2) Interpolation mismatches + f"$s%b" + f"$s%c" + f"$f%c" + f"$s%x" + f"$b%d" + f"$s%d" + f"$f%o" + f"$s%e" + f"$b%f" + + { + implicit val strToInt1 = (s: String) => 1 + implicit val strToInt2 = (s: String) => 2 + f"$s%d" + } + + f"$s%i" +} |