summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-03-18 00:34:16 +0100
committerEugene Burmako <xeno.by@gmail.com>2014-03-18 00:34:16 +0100
commitd9687d585525476ecd9544b0e367e456af1b0642 (patch)
tree9252e09a0fabeb086940f850b7ab7e072ad8fe64 /test/files/run
parent492624d729730d594097aa618f8f1e34caa79639 (diff)
downloadscala-d9687d585525476ecd9544b0e367e456af1b0642.tar.gz
scala-d9687d585525476ecd9544b0e367e456af1b0642.tar.bz2
scala-d9687d585525476ecd9544b0e367e456af1b0642.zip
SI-8425 don't create double-dollar names in c.freshName
If we append a dollar to a user-provided prefix that ends in a dollar, we create a potential for confusion for backend phases. That's why this commit prevents such situations from happening.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t8425.check1
-rw-r--r--test/files/run/t8425/Macros_1.scala12
-rw-r--r--test/files/run/t8425/Test_2.scala3
3 files changed, 16 insertions, 0 deletions
diff --git a/test/files/run/t8425.check b/test/files/run/t8425.check
new file mode 100644
index 0000000000..8379fa0a74
--- /dev/null
+++ b/test/files/run/t8425.check
@@ -0,0 +1 @@
+List(fresh$macro$1, $macro$2)
diff --git a/test/files/run/t8425/Macros_1.scala b/test/files/run/t8425/Macros_1.scala
new file mode 100644
index 0000000000..71a96518e8
--- /dev/null
+++ b/test/files/run/t8425/Macros_1.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def foo: Unit = macro impl
+ def impl(c: Context) = {
+ import c.universe._
+ val test1 = c.freshName()
+ val test2 = c.freshName("$")
+ q"println(List($test1, $test2))"
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t8425/Test_2.scala b/test/files/run/t8425/Test_2.scala
new file mode 100644
index 0000000000..acfddae942
--- /dev/null
+++ b/test/files/run/t8425/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.foo
+} \ No newline at end of file