@@ -5,16 +5,19 @@ package transform
55import core .Annotations ._
66import core .Contexts ._
77import core .Phases ._
8+ import core .Decorators .*
89import core .Definitions
910import core .Flags ._
1011import core .Names .Name
1112import core .Symbols ._
1213import core .TypeApplications .{EtaExpansion , TypeParamInfo }
13- import core .TypeErasure .{erasedGlb , erasure , isGenericArrayElement }
14+ import core .TypeErasure .{erasedGlb , erasure , fullErasure , isGenericArrayElement }
1415import core .Types ._
1516import core .classfile .ClassfileConstants
1617import SymUtils ._
1718import TypeUtils ._
19+ import config .Printers .transforms
20+ import reporting .trace
1821import java .lang .StringBuilder
1922
2023import scala .collection .mutable .ListBuffer
@@ -130,12 +133,12 @@ object GenericSignatures {
130133 else
131134 Right (parent))
132135
133- def paramSig (param : LambdaParam ): Unit = {
134- builder.append(sanitizeName(param.paramName))
136+ def paramSig (param : TypeParamInfo ): Unit = {
137+ builder.append(sanitizeName(param.paramName.lastPart ))
135138 boundsSig(hiBounds(param.paramInfo.bounds))
136139 }
137140
138- def polyParamSig (tparams : List [LambdaParam ]): Unit =
141+ def polyParamSig (tparams : List [TypeParamInfo ]): Unit =
139142 if (tparams.nonEmpty) {
140143 builder.append('<' )
141144 tparams.foreach(paramSig)
@@ -236,7 +239,11 @@ object GenericSignatures {
236239 tp match {
237240
238241 case ref @ TypeParamRef (_ : PolyType , _) =>
239- typeParamSig(ref.paramName.lastPart)
242+ val erasedUnderlying = fullErasure(ref.underlying.bounds.hi)
243+ // don't emit type param name if the param is upper-bounded by a primitive type (including via a value class)
244+ if erasedUnderlying.isPrimitiveValueType then
245+ jsig(erasedUnderlying, toplevel, primitiveOK)
246+ else typeParamSig(ref.paramName.lastPart)
240247
241248 case defn.ArrayOf (elemtp) =>
242249 if (isGenericArrayElement(elemtp, isScala2 = false ))
@@ -267,7 +274,7 @@ object GenericSignatures {
267274 else if (sym == defn.UnitClass ) jsig(defn.BoxedUnitClass .typeRef)
268275 else builder.append(defn.typeTag(sym.info))
269276 else if (ValueClasses .isDerivedValueClass(sym)) {
270- val erasedUnderlying = core. TypeErasure . fullErasure(tp)
277+ val erasedUnderlying = fullErasure(tp)
271278 if (erasedUnderlying.isPrimitiveValueType && ! primitiveOK)
272279 classSig(sym, pre, args)
273280 else
@@ -334,15 +341,6 @@ object GenericSignatures {
334341 jsig(repr, primitiveOK = primitiveOK)
335342
336343 case ci : ClassInfo =>
337- def polyParamSig (tparams : List [TypeParamInfo ]): Unit =
338- if (tparams.nonEmpty) {
339- builder.append('<' )
340- tparams.foreach { tp =>
341- builder.append(sanitizeName(tp.paramName.lastPart))
342- boundsSig(hiBounds(tp.paramInfo.bounds))
343- }
344- builder.append('>' )
345- }
346344 val tParams = tp.typeParams
347345 if (toplevel) polyParamSig(tParams)
348346 superSig(ci.typeSymbol, ci.parents)
0 commit comments