From d8985603b5d670414ea7844a628168f92a09c402 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Thu, 25 Jun 2015 09:39:15 +0200 Subject: SpecializeNames: Duplicate scalac behaviour, sort tparams --- src/dotty/tools/dotc/core/NameOps.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/dotty/tools/dotc/core/NameOps.scala') diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index 4d6cca61d..74555961e 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -236,7 +236,7 @@ object NameOps { case nme.clone_ => nme.clone_ } - def specializedFor(returnType: Types.Type, args: List[Types.Type])(implicit ctx: Context): name.ThisName = { + def specializedFor(classTargs: List[Types.Type], classTargsNames: List[Name], methodTargs: List[Types.Type], methodTarsNames: List[Name])(implicit ctx: Context): name.ThisName = { def typeToTag(tp: Types.Type): Name = { tp.classSymbol match { @@ -253,9 +253,12 @@ object NameOps { } } + val methodTags: Seq[Name] = (methodTargs zip methodTarsNames).sortBy(_._2).map(x => typeToTag(x._1)) + val classTags: Seq[Name] = (classTargs zip classTargsNames).sortBy(_._2).map(x => typeToTag(x._1)) + name.fromName(name ++ nme.specializedTypeNames.prefix ++ - args.map(typeToTag).foldRight(typeToTag(returnType))(_ ++ _) ++ - nme.specializedTypeNames.suffix) + methodTags.fold(nme.EMPTY)(_ ++ _) ++ nme.specializedTypeNames.separator ++ + classTags.fold(nme.EMPTY)(_ ++ _) ++ nme.specializedTypeNames.suffix) } /** If name length exceeds allowable limit, replace part of it by hash */ -- cgit v1.2.3