diff --git a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala index e60561fb04e2..493302961461 100644 --- a/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala +++ b/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala @@ -233,6 +233,7 @@ object GenericSignatures { @noinline def jsig(tp0: Type, toplevel: Boolean = false, unboxedVCs: Boolean = true): Unit = { + inline def jsig1(tp0: Type): Unit = jsig(tp0, toplevel = false, unboxedVCs = true) val tp = tp0.dealias tp match { @@ -241,41 +242,41 @@ object GenericSignatures { val erasedUnderlying = fullErasure(ref.underlying.bounds.hi) // don't emit type param name if the param is upper-bounded by a primitive type (including via a value class) if erasedUnderlying.isPrimitiveValueType then - jsig(erasedUnderlying, toplevel, unboxedVCs) + jsig(erasedUnderlying, toplevel = toplevel, unboxedVCs = unboxedVCs) else typeParamSig(ref.paramName.lastPart) case defn.ArrayOf(elemtp) => if (isGenericArrayElement(elemtp, isScala2 = false)) - jsig(defn.ObjectType) + jsig1(defn.ObjectType) else builder.append(ClassfileConstants.ARRAY_TAG) elemtp match - case TypeBounds(lo, hi) => jsig(hi.widenDealias) - case _ => jsig(elemtp) + case TypeBounds(lo, hi) => jsig1(hi.widenDealias) + case _ => jsig1(elemtp) case RefOrAppliedType(sym, pre, args) => if (sym == defn.PairClass && tupleArity(tp) > Definitions.MaxTupleArity) - jsig(defn.TupleXXLClass.typeRef) + jsig1(defn.TupleXXLClass.typeRef) else if (isTypeParameterInSig(sym, sym0)) { assert(!sym.isAliasType, "Unexpected alias type: " + sym) typeParamSig(sym.name.lastPart) } else if (defn.specialErasure.contains(sym)) - jsig(defn.specialErasure(sym).nn.typeRef) + jsig1(defn.specialErasure(sym).nn.typeRef) else if (sym == defn.UnitClass || sym == defn.BoxedUnitModule) - jsig(defn.BoxedUnitClass.typeRef) + jsig1(defn.BoxedUnitClass.typeRef) else if (sym == defn.NothingClass) builder.append("Lscala/runtime/Nothing$;") else if (sym == defn.NullClass) builder.append("Lscala/runtime/Null$;") else if (sym.isPrimitiveValueClass) - if (!unboxedVCs) jsig(defn.ObjectType) - else if (sym == defn.UnitClass) jsig(defn.BoxedUnitClass.typeRef) + if (!unboxedVCs) jsig1(defn.ObjectType) + else if (sym == defn.UnitClass) jsig1(defn.BoxedUnitClass.typeRef) else builder.append(defn.typeTag(sym.info)) else if (sym.isDerivedValueClass) { if (unboxedVCs) { val erasedUnderlying = fullErasure(tp) - jsig(erasedUnderlying, toplevel) + jsig(erasedUnderlying, toplevel = toplevel, unboxedVCs = true) } else classSig(sym, pre, args) } else if (defn.isSyntheticFunctionClass(sym)) { @@ -285,14 +286,14 @@ object GenericSignatures { else if sym.isClass then classSig(sym, pre, args) else - jsig(erasure(tp), toplevel, unboxedVCs) + jsig(erasure(tp), toplevel = toplevel, unboxedVCs = unboxedVCs) case ExprType(restpe) if toplevel => builder.append("()") methodResultSig(restpe) case ExprType(restpe) => - jsig(defn.FunctionType(0).appliedTo(restpe)) + jsig1(defn.FunctionType(0).appliedTo(restpe)) case PolyType(tparams, mtpe: MethodType) => assert(tparams.nonEmpty) @@ -320,7 +321,7 @@ object GenericSignatures { builder.append('(') // TODO: Update once we support varargs params.foreach { tp => - jsig(tp) + jsig1(tp) } builder.append(')') methodResultSig(restpe) @@ -338,7 +339,7 @@ object GenericSignatures { val (reprParents, _) = splitIntersection(parents) val repr = reprParents.find(_.typeSymbol.is(TypeParam)).getOrElse(reprParents.head) - jsig(repr, unboxedVCs = unboxedVCs) + jsig(repr, toplevel = false, unboxedVCs = unboxedVCs) case ci: ClassInfo => val tParams = tp.typeParams diff --git a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala index 20b6a2e5b272..bc7f8631492b 100644 --- a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala +++ b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala @@ -460,8 +460,8 @@ object SpaceEngine { val inArray = tycon.isRef(defn.ArrayClass) || tp.translucentSuperType.isRef(defn.ArrayClass) val args2 = if isTyped && !inArray then args.map(_ => WildcardType) - else args.map(arg => erase(arg, inArray = inArray, isValue = false)) - tp.derivedAppliedType(erase(tycon, inArray, isValue = false), args2) + else args.map(arg => erase(arg, inArray = inArray, isValue = false, isTyped = false)) + tp.derivedAppliedType(erase(tycon, inArray = inArray, isValue = false, isTyped = false), args2) case tp @ OrType(tp1, tp2) => OrType(erase(tp1, inArray, isValue), erase(tp2, inArray, isValue), tp.isSoft)