diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-03-18 00:34:16 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-03-18 00:34:16 +0100 |
commit | d9687d585525476ecd9544b0e367e456af1b0642 (patch) | |
tree | 9252e09a0fabeb086940f850b7ab7e072ad8fe64 /src/compiler/scala/reflect/macros | |
parent | 492624d729730d594097aa618f8f1e34caa79639 (diff) | |
download | scala-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 'src/compiler/scala/reflect/macros')
-rw-r--r-- | src/compiler/scala/reflect/macros/contexts/Names.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/reflect/macros/contexts/Names.scala b/src/compiler/scala/reflect/macros/contexts/Names.scala index 299af40b94..5a5bb428b5 100644 --- a/src/compiler/scala/reflect/macros/contexts/Names.scala +++ b/src/compiler/scala/reflect/macros/contexts/Names.scala @@ -33,8 +33,9 @@ trait Names { // // TODO: hopefully SI-7823 will provide an ultimate answer to this problem. // In the meanwhile I will also keep open the original issue: SI-6879 "c.freshName is broken". + val prefix = if (name.endsWith("$")) name else name + "$" // SI-8425 val sortOfUniqueSuffix = freshNameCreator.newName(nme.FRESH_SUFFIX) - name + "$" + sortOfUniqueSuffix + prefix + sortOfUniqueSuffix } def freshName[NameType <: Name](name: NameType): NameType = |