aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-19 15:56:23 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-19 15:56:23 +0200
commitedb9facac55f61540e0f9af8d06ac9390830fcb8 (patch)
tree9cfec6438727a6cf8925b316a0bcfe51a57751a1 /src/dotty
parent330fee9d79d2f414dcc02c494ba6d632d4ecbb8f (diff)
downloaddotty-edb9facac55f61540e0f9af8d06ac9390830fcb8.tar.gz
dotty-edb9facac55f61540e0f9af8d06ac9390830fcb8.tar.bz2
dotty-edb9facac55f61540e0f9af8d06ac9390830fcb8.zip
Made NameTransformer encode return the kind of name it is given.
Fixes a bug in typedIdent.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/util/NameTransformer.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/util/NameTransformer.scala b/src/dotty/tools/dotc/util/NameTransformer.scala
index be77dd9a6..ecb480549 100644
--- a/src/dotty/tools/dotc/util/NameTransformer.scala
+++ b/src/dotty/tools/dotc/util/NameTransformer.scala
@@ -60,7 +60,7 @@ object NameTransformer {
* @param name the string to encode
* @return the string with all recognized opchars replaced with their encoding
*/
- def encode(name: Name): TermName = {
+ def encode[N <: Name](name: N): N = {
var buf: StringBuilder = null
val len = name.length
var i = 0
@@ -86,7 +86,9 @@ object NameTransformer {
}
i += 1
}
- if (buf eq null) name.toTermName else buf.toString.toTermName
+ if (buf eq null) name
+ else if (name.isTermName) buf.toString.toTermName.asInstanceOf[N]
+ else buf.toString.toTypeName.asInstanceOf[N]
}
/** Replace `\$opname` by corresponding operator symbol.