aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/util/NameTransformer.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools/dotc/util/NameTransformer.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/util/NameTransformer.scala5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/util/NameTransformer.scala b/compiler/src/dotty/tools/dotc/util/NameTransformer.scala
index 330d513fe..52f8e6ec0 100644
--- a/compiler/src/dotty/tools/dotc/util/NameTransformer.scala
+++ b/compiler/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[N <: Name](name: N): N = {
+ def encode(name: SimpleTermName): SimpleTermName = {
var buf: StringBuilder = null
val len = name.length
var i = 0
@@ -87,8 +87,7 @@ object NameTransformer {
i += 1
}
if (buf eq null) name
- else if (name.isTermName) buf.toString.toTermName.asInstanceOf[N]
- else buf.toString.toTypeName.asInstanceOf[N]
+ else termName(buf.toString)
}
/** Replace `\$opname` by corresponding operator symbol.