aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
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.