Skip to content

Commit d97c584

Browse files
committed
Rename PolyTypeTree -> LambdaTypeTree
1 parent 07df610 commit d97c584

File tree

13 files changed

+44
-44
lines changed

13 files changed

+44
-44
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ object desugar {
153153
case ContextBounds(tbounds, cxbounds) =>
154154
epbuf ++= makeImplicitParameters(cxbounds, isPrimaryConstructor)
155155
tbounds
156-
case PolyTypeTree(tparams, body) =>
157-
cpy.PolyTypeTree(rhs)(tparams, desugarContextBounds(body))
156+
case LambdaTypeTree(tparams, body) =>
157+
cpy.LambdaTypeTree(rhs)(tparams, desugarContextBounds(body))
158158
case _ =>
159159
rhs
160160
}

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ trait UntypedTreeInfo extends TreeInfo[Untyped] { self: Trees.Instance[Untyped]
262262
case mdef: TypeDef =>
263263
def isBounds(rhs: Tree): Boolean = rhs match {
264264
case _: TypeBoundsTree => true
265-
case PolyTypeTree(_, body) => isBounds(body)
265+
case LambdaTypeTree(_, body) => isBounds(body)
266266
case _ => false
267267
}
268268
mdef.rhs.isEmpty || isBounds(mdef.rhs)

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,9 @@ object Trees {
578578
}
579579

580580
/** [typeparams] -> tpt */
581-
case class PolyTypeTree[-T >: Untyped] private[ast] (tparams: List[TypeDef[T]], body: Tree[T])
581+
case class LambdaTypeTree[-T >: Untyped] private[ast] (tparams: List[TypeDef[T]], body: Tree[T])
582582
extends TypTree[T] {
583-
type ThisTree[-T >: Untyped] = PolyTypeTree[T]
583+
type ThisTree[-T >: Untyped] = LambdaTypeTree[T]
584584
}
585585

586586
/** => T */
@@ -833,7 +833,7 @@ object Trees {
833833
type OrTypeTree = Trees.OrTypeTree[T]
834834
type RefinedTypeTree = Trees.RefinedTypeTree[T]
835835
type AppliedTypeTree = Trees.AppliedTypeTree[T]
836-
type PolyTypeTree = Trees.PolyTypeTree[T]
836+
type LambdaTypeTree = Trees.LambdaTypeTree[T]
837837
type ByNameTypeTree = Trees.ByNameTypeTree[T]
838838
type TypeBoundsTree = Trees.TypeBoundsTree[T]
839839
type Bind = Trees.Bind[T]
@@ -998,9 +998,9 @@ object Trees {
998998
case tree: AppliedTypeTree if (tpt eq tree.tpt) && (args eq tree.args) => tree
999999
case _ => finalize(tree, untpd.AppliedTypeTree(tpt, args))
10001000
}
1001-
def PolyTypeTree(tree: Tree)(tparams: List[TypeDef], body: Tree): PolyTypeTree = tree match {
1002-
case tree: PolyTypeTree if (tparams eq tree.tparams) && (body eq tree.body) => tree
1003-
case _ => finalize(tree, untpd.PolyTypeTree(tparams, body))
1001+
def LambdaTypeTree(tree: Tree)(tparams: List[TypeDef], body: Tree): LambdaTypeTree = tree match {
1002+
case tree: LambdaTypeTree if (tparams eq tree.tparams) && (body eq tree.body) => tree
1003+
case _ => finalize(tree, untpd.LambdaTypeTree(tparams, body))
10041004
}
10051005
def ByNameTypeTree(tree: Tree)(result: Tree): ByNameTypeTree = tree match {
10061006
case tree: ByNameTypeTree if result eq tree.result => tree
@@ -1144,8 +1144,8 @@ object Trees {
11441144
cpy.RefinedTypeTree(tree)(transform(tpt), transformSub(refinements))
11451145
case AppliedTypeTree(tpt, args) =>
11461146
cpy.AppliedTypeTree(tree)(transform(tpt), transform(args))
1147-
case PolyTypeTree(tparams, body) =>
1148-
cpy.PolyTypeTree(tree)(transformSub(tparams), transform(body))
1147+
case LambdaTypeTree(tparams, body) =>
1148+
cpy.LambdaTypeTree(tree)(transformSub(tparams), transform(body))
11491149
case ByNameTypeTree(result) =>
11501150
cpy.ByNameTypeTree(tree)(transform(result))
11511151
case TypeBoundsTree(lo, hi) =>
@@ -1248,7 +1248,7 @@ object Trees {
12481248
this(this(x, tpt), refinements)
12491249
case AppliedTypeTree(tpt, args) =>
12501250
this(this(x, tpt), args)
1251-
case PolyTypeTree(tparams, body) =>
1251+
case LambdaTypeTree(tparams, body) =>
12521252
implicit val ctx = localCtx
12531253
this(this(x, tparams), body)
12541254
case ByNameTypeTree(result) =>

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
145145
def ByNameTypeTree(result: Tree)(implicit ctx: Context): ByNameTypeTree =
146146
ta.assignType(untpd.ByNameTypeTree(result), result)
147147

148-
def PolyTypeTree(tparams: List[TypeDef], body: Tree)(implicit ctx: Context): PolyTypeTree =
149-
ta.assignType(untpd.PolyTypeTree(tparams, body), tparams, body)
148+
def LambdaTypeTree(tparams: List[TypeDef], body: Tree)(implicit ctx: Context): LambdaTypeTree =
149+
ta.assignType(untpd.LambdaTypeTree(tparams, body), tparams, body)
150150

151151
def TypeBoundsTree(lo: Tree, hi: Tree)(implicit ctx: Context): TypeBoundsTree =
152152
ta.assignType(untpd.TypeBoundsTree(lo, hi), lo, hi)

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
261261
def OrTypeTree(left: Tree, right: Tree): OrTypeTree = new OrTypeTree(left, right)
262262
def RefinedTypeTree(tpt: Tree, refinements: List[Tree]): RefinedTypeTree = new RefinedTypeTree(tpt, refinements)
263263
def AppliedTypeTree(tpt: Tree, args: List[Tree]): AppliedTypeTree = new AppliedTypeTree(tpt, args)
264-
def PolyTypeTree(tparams: List[TypeDef], body: Tree): PolyTypeTree = new PolyTypeTree(tparams, body)
264+
def LambdaTypeTree(tparams: List[TypeDef], body: Tree): LambdaTypeTree = new LambdaTypeTree(tparams, body)
265265
def ByNameTypeTree(result: Tree): ByNameTypeTree = new ByNameTypeTree(result)
266266
def TypeBoundsTree(lo: Tree, hi: Tree): TypeBoundsTree = new TypeBoundsTree(lo, hi)
267267
def Bind(name: Name, body: Tree): Bind = new Bind(name, body)
@@ -352,7 +352,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
352352
ValDef(nme.syntheticParamName(n), tpt, EmptyTree).withFlags(SyntheticTermParam)
353353

354354
def lambdaAbstract(tparams: List[TypeDef], tpt: Tree)(implicit ctx: Context) =
355-
if (tparams.isEmpty) tpt else PolyTypeTree(tparams, tpt)
355+
if (tparams.isEmpty) tpt else LambdaTypeTree(tparams, tpt)
356356

357357
/** A reference to given definition. If definition is a repeated
358358
* parameter, the reference will be a repeated argument.

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ object Types {
103103
final def isValueType: Boolean = this.isInstanceOf[ValueType]
104104

105105
/** Is the is value type or type lambda? */
106-
final def isValueTypeOrLambda: Boolean = isValueType || this.isInstanceOf[PolyType]
106+
final def isValueTypeOrLambda: Boolean = isValueType || this.isInstanceOf[TypeLambda]
107107

108108
/** Does this type denote a stable reference (i.e. singleton type)? */
109109
@tailrec final def isStable(implicit ctx: Context): Boolean = stripTypeVar match {
@@ -541,7 +541,7 @@ object Types {
541541
}
542542

543543
def goApply(tp: HKApply) = tp.tycon match {
544-
case tl: PolyType =>
544+
case tl: TypeLambda =>
545545
go(tl.resType).mapInfo(info =>
546546
tl.derivedLambdaAbstraction(tl.paramNames, tl.paramInfos, info).appliedTo(tp.args))
547547
case _ =>
@@ -1090,33 +1090,33 @@ object Types {
10901090
/** The parameter types of a PolyType or MethodType, Empty list for others */
10911091
final def paramInfoss(implicit ctx: Context): List[List[Type]] = this match {
10921092
case mt: MethodType => mt.paramInfos :: mt.resultType.paramInfoss
1093-
case pt: PolyType => pt.resultType.paramInfoss
1093+
case pt: TypeLambda => pt.resultType.paramInfoss
10941094
case _ => Nil
10951095
}
10961096

10971097
/** The parameter names of a PolyType or MethodType, Empty list for others */
10981098
final def paramNamess(implicit ctx: Context): List[List[TermName]] = this match {
10991099
case mt: MethodType => mt.paramNames :: mt.resultType.paramNamess
1100-
case pt: PolyType => pt.resultType.paramNamess
1100+
case pt: TypeLambda => pt.resultType.paramNamess
11011101
case _ => Nil
11021102
}
11031103

11041104

11051105
/** The parameter types in the first parameter section of a generic type or MethodType, Empty list for others */
11061106
final def firstParamTypes(implicit ctx: Context): List[Type] = this match {
11071107
case mt: MethodType => mt.paramInfos
1108-
case pt: PolyType => pt.resultType.firstParamTypes
1108+
case pt: TypeLambda => pt.resultType.firstParamTypes
11091109
case _ => Nil
11101110
}
11111111

11121112
/** Is this either not a method at all, or a parameterless method? */
11131113
final def isParameterless(implicit ctx: Context): Boolean = this match {
11141114
case mt: MethodType => false
1115-
case pt: PolyType => pt.resultType.isParameterless
1115+
case pt: TypeLambda => pt.resultType.isParameterless
11161116
case _ => true
11171117
}
11181118

1119-
/** The resultType of a PolyType, MethodType, or ExprType, the type itself for others */
1119+
/** The resultType of a LambdaType, or ExprType, the type itself for others */
11201120
def resultType(implicit ctx: Context): Type = this
11211121

11221122
/** The final result type of a PolyType, MethodType, or ExprType, after skipping
@@ -1360,7 +1360,7 @@ object Types {
13601360
}
13611361

13621362
/** A marker trait for types that bind other types that refer to them.
1363-
* Instances are: PolyType, MethodType, RefinedType.
1363+
* Instances are: LambdaType, RecType.
13641364
*/
13651365
trait BindingType extends Type
13661366

@@ -2800,7 +2800,7 @@ object Types {
28002800
override def superType(implicit ctx: Context): Type = {
28012801
if (ctx.period != validSuper) {
28022802
cachedSuper = tycon match {
2803-
case tp: PolyType => defn.AnyType
2803+
case tp: TypeLambda => defn.AnyType
28042804
case tp: TypeVar if !tp.inst.exists =>
28052805
// supertype not stable, since underlying might change
28062806
return tp.underlying.applyIfParameterized(args)
@@ -2826,7 +2826,7 @@ object Types {
28262826

28272827
def typeParams(implicit ctx: Context): List[ParamInfo] = {
28282828
val tparams = tycon.typeParams
2829-
if (tparams.isEmpty) PolyType.any(args.length).typeParams else tparams
2829+
if (tparams.isEmpty) HKTypeLambda.any(args.length).typeParams else tparams
28302830
}
28312831

28322832
def derivedAppliedType(tycon: Type, args: List[Type])(implicit ctx: Context): Type =
@@ -2839,7 +2839,7 @@ object Types {
28392839
def check(tycon: Type): Unit = tycon.stripTypeVar match {
28402840
case tycon: TypeRef if !tycon.symbol.isClass =>
28412841
case _: TypeParamRef | _: ErrorType | _: WildcardType =>
2842-
case _: PolyType =>
2842+
case _: TypeLambda =>
28432843
assert(args.exists(_.isInstanceOf[TypeBounds]), s"unreduced type apply: $this")
28442844
case tycon: AnnotatedType =>
28452845
check(tycon.underlying)
@@ -3526,7 +3526,7 @@ object Types {
35263526
case tp: ExprType =>
35273527
derivedExprType(tp, this(tp.resultType))
35283528

3529-
case tp: PolyType =>
3529+
case tp: TypeLambda =>
35303530
def mapOverPoly = {
35313531
variance = -variance
35323532
val bounds1 = tp.paramInfos.mapConserve(this).asInstanceOf[List[TypeBounds]]
@@ -3751,7 +3751,7 @@ object Types {
37513751
case ExprType(restpe) =>
37523752
this(x, restpe)
37533753

3754-
case tp: PolyType =>
3754+
case tp: TypeLambda =>
37553755
variance = -variance
37563756
val y = foldOver(x, tp.paramInfos)
37573757
variance = -variance

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ class TreePickler(pickler: TastyPickler) {
553553
case Annotated(tree, annot) =>
554554
writeByte(ANNOTATEDtpt)
555555
withLength { pickleTree(tree); pickleTree(annot.tree) }
556-
case PolyTypeTree(tparams, body) =>
556+
case LambdaTypeTree(tparams, body) =>
557557
writeByte(POLYtpt)
558558
withLength { pickleParams(tparams); pickleTree(body) }
559559
case TypeBoundsTree(lo, hi) =>

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle
10351035
val localCtx = localNonClassCtx
10361036
val tparams = readParams[TypeDef](TYPEPARAM)(localCtx)
10371037
val body = readTpt()(localCtx)
1038-
PolyTypeTree(tparams, body)
1038+
LambdaTypeTree(tparams, body)
10391039
case TYPEBOUNDStpt =>
10401040
TypeBoundsTree(readTpt(), readTpt())
10411041
case _ =>

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ object Parsers {
720720
val start = in.offset
721721
val tparams = typeParamClause(ParamOwner.TypeParam)
722722
if (in.token == ARROW)
723-
atPos(start, in.skipToken())(PolyTypeTree(tparams, typ()))
723+
atPos(start, in.skipToken())(LambdaTypeTree(tparams, typ()))
724724
else { accept(ARROW); typ() }
725725
}
726726
else infixType()

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
401401
toTextLocal(tpt) ~ " " ~ blockText(refines)
402402
case AppliedTypeTree(tpt, args) =>
403403
toTextLocal(tpt) ~ "[" ~ Text(args map argText, ", ") ~ "]"
404-
case PolyTypeTree(tparams, body) =>
404+
case LambdaTypeTree(tparams, body) =>
405405
changePrec(GlobalPrec) {
406406
tparamsText(tparams) ~ " -> " ~ toText(body)
407407
}
@@ -451,7 +451,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
451451
(if (tree.hasType && ctx.settings.verbose.value) i"[decls = ${tree.symbol.info.decls}]" else "")
452452
case rhs: TypeBoundsTree =>
453453
typeDefText(tparamsTxt, toText(rhs))
454-
case PolyTypeTree(tparams, body) =>
454+
case LambdaTypeTree(tparams, body) =>
455455
recur(body, tparamsText(tparams))
456456
case rhs =>
457457
typeDefText(tparamsTxt, optText(rhs)(" = " ~ _))

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class Namer { typer: Typer =>
298298
val inSuperCall1 = if (tree.mods is ParamOrAccessor) EmptyFlags else inSuperCall
299299
// suppress inSuperCall for constructor parameters
300300
val higherKinded = tree match {
301-
case TypeDef(_, PolyTypeTree(_, _)) if isDeferred => HigherKinded
301+
case TypeDef(_, LambdaTypeTree(_, _)) if isDeferred => HigherKinded
302302
case _ => EmptyFlags
303303
}
304304

@@ -766,7 +766,7 @@ class Namer { typer: Typer =>
766766
myTypeParams = {
767767
implicit val ctx = nestedCtx
768768
val tparams = original.rhs match {
769-
case PolyTypeTree(tparams, _) => tparams
769+
case LambdaTypeTree(tparams, _) => tparams
770770
case _ => Nil
771771
}
772772
completeParams(tparams)
@@ -1140,7 +1140,7 @@ class Namer { typer: Typer =>
11401140

11411141
val isDerived = tdef.rhs.isInstanceOf[untpd.DerivedTypeTree]
11421142
val rhs = tdef.rhs match {
1143-
case PolyTypeTree(_, body) => body
1143+
case LambdaTypeTree(_, body) => body
11441144
case rhs => rhs
11451145
}
11461146
val rhsBodyType = typedAheadType(rhs).tpe

compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ trait TypeAssigner {
457457
tree.withType(ownType)
458458
}
459459

460-
def assignType(tree: untpd.PolyTypeTree, tparamDefs: List[TypeDef], body: Tree)(implicit ctx: Context) =
460+
def assignType(tree: untpd.LambdaTypeTree, tparamDefs: List[TypeDef], body: Tree)(implicit ctx: Context) =
461461
tree.withType(body.tpe.LambdaAbstract(tparamDefs.map(_.symbol)))
462462

463463
def assignType(tree: untpd.ByNameTypeTree, result: Tree)(implicit ctx: Context) =

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,12 +1096,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
10961096
}
10971097
}
10981098

1099-
def typedPolyTypeTree(tree: untpd.PolyTypeTree)(implicit ctx: Context): Tree = track("typedPolyTypeTree") {
1100-
val PolyTypeTree(tparams, body) = tree
1099+
def typedLambdaTypeTree(tree: untpd.LambdaTypeTree)(implicit ctx: Context): Tree = track("typedLambdaTypeTree") {
1100+
val LambdaTypeTree(tparams, body) = tree
11011101
indexAndAnnotate(tparams)
11021102
val tparams1 = tparams.mapconserve(typed(_).asInstanceOf[TypeDef])
11031103
val body1 = typedType(tree.body)
1104-
assignType(cpy.PolyTypeTree(tree)(tparams1, body1), tparams1, body1)
1104+
assignType(cpy.LambdaTypeTree(tree)(tparams1, body1), tparams1, body1)
11051105
}
11061106

11071107
def typedByNameTypeTree(tree: untpd.ByNameTypeTree)(implicit ctx: Context): ByNameTypeTree = track("typedByNameTypeTree") {
@@ -1262,10 +1262,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
12621262
val TypeDef(name, rhs) = tdef
12631263
completeAnnotations(tdef, sym)
12641264
val rhs1 = tdef.rhs match {
1265-
case rhs @ PolyTypeTree(tparams, body) =>
1265+
case rhs @ LambdaTypeTree(tparams, body) =>
12661266
val tparams1 = tparams.map(typed(_)).asInstanceOf[List[TypeDef]]
12671267
val body1 = typedType(body)
1268-
assignType(cpy.PolyTypeTree(rhs)(tparams1, body1), tparams1, body1)
1268+
assignType(cpy.LambdaTypeTree(rhs)(tparams1, body1), tparams1, body1)
12691269
case rhs =>
12701270
typedType(rhs)
12711271
}
@@ -1555,7 +1555,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
15551555
case tree: untpd.OrTypeTree => typedOrTypeTree(tree)
15561556
case tree: untpd.RefinedTypeTree => typedRefinedTypeTree(tree)
15571557
case tree: untpd.AppliedTypeTree => typedAppliedTypeTree(tree)
1558-
case tree: untpd.PolyTypeTree => typedPolyTypeTree(tree)(localContext(tree, NoSymbol).setNewScope)
1558+
case tree: untpd.LambdaTypeTree => typedLambdaTypeTree(tree)(localContext(tree, NoSymbol).setNewScope)
15591559
case tree: untpd.ByNameTypeTree => typedByNameTypeTree(tree)
15601560
case tree: untpd.TypeBoundsTree => typedTypeBoundsTree(tree)
15611561
case tree: untpd.Alternative => typedAlternative(tree, pt)

0 commit comments

Comments
 (0)