Skip to content

Commit 9b04c6d

Browse files
committed
port fix to the right place
1 parent 2738524 commit 9b04c6d

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ object GenericSignatures {
6464
ps.foreach(boxedSig)
6565
}
6666

67-
def boxedSig(tp: Type): Unit = jsig(tp.widenDealias, primitiveOK = false)
67+
def boxedSig(tp: Type): Unit = jsig(tp.widenDealias, unboxedVCs = false)
6868

6969
/** The signature of the upper-bound of a type parameter.
7070
*
@@ -232,7 +232,7 @@ object GenericSignatures {
232232
}
233233

234234
@noinline
235-
def jsig(tp0: Type, toplevel: Boolean = false, primitiveOK: Boolean = true): Unit = {
235+
def jsig(tp0: Type, toplevel: Boolean = false, unboxedVCs: Boolean = true): Unit = {
236236

237237
val tp = tp0.dealias
238238
tp match {
@@ -241,7 +241,7 @@ object GenericSignatures {
241241
val erasedUnderlying = fullErasure(ref.underlying.bounds.hi)
242242
// don't emit type param name if the param is upper-bounded by a primitive type (including via a value class)
243243
if erasedUnderlying.isPrimitiveValueType then
244-
jsig(erasedUnderlying, toplevel, primitiveOK)
244+
jsig(erasedUnderlying, toplevel, unboxedVCs)
245245
else typeParamSig(ref.paramName.lastPart)
246246

247247
case defn.ArrayOf(elemtp) =>
@@ -269,15 +269,14 @@ object GenericSignatures {
269269
else if (sym == defn.NullClass)
270270
builder.append("Lscala/runtime/Null$;")
271271
else if (sym.isPrimitiveValueClass)
272-
if (!primitiveOK) jsig(defn.ObjectType)
272+
if (!unboxedVCs) jsig(defn.ObjectType)
273273
else if (sym == defn.UnitClass) jsig(defn.BoxedUnitClass.typeRef)
274274
else builder.append(defn.typeTag(sym.info))
275275
else if (sym.isDerivedValueClass) {
276-
val erasedUnderlying = fullErasure(tp)
277-
if (erasedUnderlying.isPrimitiveValueType && !primitiveOK)
278-
classSig(sym, pre, args)
279-
else
280-
jsig(erasedUnderlying, toplevel, primitiveOK)
276+
if (unboxedVCs) {
277+
val erasedUnderlying = fullErasure(tp)
278+
jsig(erasedUnderlying, toplevel)
279+
} else classSig(sym, pre, args)
281280
}
282281
else if (defn.isSyntheticFunctionClass(sym)) {
283282
val erasedSym = defn.functionTypeErasure(sym).typeSymbol
@@ -286,7 +285,7 @@ object GenericSignatures {
286285
else if sym.isClass then
287286
classSig(sym, pre, args)
288287
else
289-
jsig(erasure(tp), toplevel, primitiveOK)
288+
jsig(erasure(tp), toplevel, unboxedVCs)
290289

291290
case ExprType(restpe) if toplevel =>
292291
builder.append("()")
@@ -339,23 +338,23 @@ object GenericSignatures {
339338
val (reprParents, _) = splitIntersection(parents)
340339
val repr =
341340
reprParents.find(_.typeSymbol.is(TypeParam)).getOrElse(reprParents.head)
342-
jsig(repr, primitiveOK = primitiveOK)
341+
jsig(repr, unboxedVCs = unboxedVCs)
343342

344343
case ci: ClassInfo =>
345344
val tParams = tp.typeParams
346345
if (toplevel) polyParamSig(tParams)
347346
superSig(ci.typeSymbol, ci.parents)
348347

349348
case AnnotatedType(atp, _) =>
350-
jsig(atp, toplevel, primitiveOK)
349+
jsig(atp, toplevel, unboxedVCs)
351350

352351
case hktl: HKTypeLambda =>
353-
jsig(hktl.finalResultType, toplevel, primitiveOK)
352+
jsig(hktl.finalResultType, toplevel, unboxedVCs)
354353

355354
case _ =>
356355
val etp = erasure(tp)
357356
if (etp eq tp) throw new UnknownSig
358-
else jsig(etp, toplevel, primitiveOK)
357+
else jsig(etp, toplevel, unboxedVCs)
359358
}
360359
}
361360
val throwsArgs = sym0.annotations flatMap ThrownException.unapply

0 commit comments

Comments
 (0)