Skip to content

Commit f3c8fdd

Browse files
committed
Merge syntheticTypeParamNames and syntheticLambdaParamNames
It seems like overengineering to use different names for poly methods in definitions and synthetic lambdas.
1 parent 49cef12 commit f3c8fdd

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/dotty/tools/dotc/core/StdNames.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -735,15 +735,11 @@ object StdNames {
735735
class ScalaTypeNames extends ScalaNames[TypeName] {
736736
protected implicit def fromString(s: String): TypeName = typeName(s)
737737

738-
def syntheticTypeParamName(i: Int): TypeName = "T" + i
739-
def syntheticLambdaParamName(i: Int): TypeName = "X" + i
738+
def syntheticTypeParamName(i: Int): TypeName = "X" + i
740739

741740
def syntheticTypeParamNames(num: Int): List[TypeName] =
742741
(0 until num).map(syntheticTypeParamName)(breakOut)
743742

744-
def syntheticLambdaParamNames(num: Int): List[TypeName] =
745-
(0 until num).map(syntheticLambdaParamName)(breakOut)
746-
747743
final val Conforms = encode("<:<")
748744

749745
final val Uninstantiated: TypeName = "?$"

src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
12671267
original(tp1.appliedTo(tp1.typeParams.map(_.paramBoundsAsSeenFrom(tp1))), tp2)
12681268
else
12691269
PolyType(
1270-
paramNames = tpnme.syntheticLambdaParamNames(tparams1.length),
1270+
paramNames = tpnme.syntheticTypeParamNames(tparams1.length),
12711271
variances = (tparams1, tparams2).zipped.map((tparam1, tparam2) =>
12721272
(tparam1.paramVariance + tparam2.paramVariance) / 2))(
12731273
paramBoundsExp = tl => (tparams1, tparams2).zipped.map((tparam1, tparam2) =>

src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,7 @@ object Types {
26232623
Some((tl.typeParams, tl.resType))
26242624

26252625
def any(n: Int)(implicit ctx: Context) =
2626-
apply(tpnme.syntheticLambdaParamNames(n), List.fill(n)(0))(
2626+
apply(tpnme.syntheticTypeParamNames(n), List.fill(n)(0))(
26272627
pt => List.fill(n)(TypeBounds.empty), pt => defn.AnyType)
26282628
}
26292629

0 commit comments

Comments
 (0)