aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-18 18:46:24 +0100
committerMartin Odersky <odersky@gmail.com>2017-04-06 13:15:28 +0200
commitf6c61f3976a2780ce42ea6cd814986b662570687 (patch)
tree55ba214a169584e8ea2d7faff5c34296951b9b3b /compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
parent8b1340b9b73d319ef7ac8f7f3bdaa75943de277e (diff)
downloaddotty-f6c61f3976a2780ce42ea6cd814986b662570687.tar.gz
dotty-f6c61f3976a2780ce42ea6cd814986b662570687.tar.bz2
dotty-f6c61f3976a2780ce42ea6cd814986b662570687.zip
Split HKTypeLambda from PolyType
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala24
1 files changed, 12 insertions, 12 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
index a27175abd..ab342dc17 100644
--- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
+++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
@@ -369,35 +369,35 @@ object ProtoTypes {
/** A prototype for type constructors that are followed by a type application */
@sharable object AnyTypeConstructorProto extends UncachedGroundType with MatchAlways
- /** Add all parameters in given polytype `pt` to the constraint's domain.
+ /** Add all parameters of given type lambda `tl` to the constraint's domain.
* If the constraint contains already some of these parameters in its domain,
- * make a copy of the polytype and add the copy's type parameters instead.
- * Return either the original polytype, or the copy, if one was made.
+ * make a copy of the type lambda and add the copy's type parameters instead.
+ * Return either the original type lambda, or the copy, if one was made.
* Also, if `owningTree` is non-empty, add a type variable for each parameter.
- * @return The added polytype, and the list of created type variables.
+ * @return The added type lambda, and the list of created type variables.
*/
- def constrained(pt: PolyType, owningTree: untpd.Tree)(implicit ctx: Context): (PolyType, List[TypeTree]) = {
+ def constrained(tl: TypeLambda, owningTree: untpd.Tree)(implicit ctx: Context): (TypeLambda, List[TypeTree]) = {
val state = ctx.typerState
assert(!(ctx.typerState.isCommittable && owningTree.isEmpty),
s"inconsistent: no typevars were added to committable constraint ${state.constraint}")
- def newTypeVars(pt: PolyType): List[TypeTree] =
- for (n <- (0 until pt.paramNames.length).toList)
+ def newTypeVars(tl: TypeLambda): List[TypeTree] =
+ for (n <- (0 until tl.paramNames.length).toList)
yield {
val tt = new TypeTree().withPos(owningTree.pos)
- tt.withType(new TypeVar(TypeParamRef(pt, n), state, tt, ctx.owner))
+ tt.withType(new TypeVar(TypeParamRef(tl, n), state, tt, ctx.owner))
}
val added =
- if (state.constraint contains pt) pt.newLikeThis(pt.paramNames, pt.paramInfos, pt.resultType)
- else pt
+ if (state.constraint contains tl) tl.newLikeThis(tl.paramNames, tl.paramInfos, tl.resultType)
+ else tl
val tvars = if (owningTree.isEmpty) Nil else newTypeVars(added)
ctx.typeComparer.addToConstraint(added, tvars.tpes.asInstanceOf[List[TypeVar]])
(added, tvars)
}
- /** Same as `constrained(pt, EmptyTree)`, but returns just the created polytype */
- def constrained(pt: PolyType)(implicit ctx: Context): PolyType = constrained(pt, EmptyTree)._1
+ /** Same as `constrained(tl, EmptyTree)`, but returns just the created type lambda */
+ def constrained(tl: TypeLambda)(implicit ctx: Context): TypeLambda = constrained(tl, EmptyTree)._1
/** Create a new TypeParamRef that represents a dependent method parameter singleton */
def newDepTypeParamRef(tp: Type)(implicit ctx: Context): TypeParamRef = {