aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-18 11:48:48 +0100
committerMartin Odersky <odersky@gmail.com>2017-04-06 13:15:28 +0200
commitc67217594bb40e1eab7e567c97bdf29ac0654864 (patch)
treed6f684b1854b5f869c98e444a558aee3878e02a2 /compiler/src/dotty/tools/dotc/typer
parentdb4f7a19c9329d59da09a4de6b8476b4b6988cdf (diff)
downloaddotty-c67217594bb40e1eab7e567c97bdf29ac0654864.tar.gz
dotty-c67217594bb40e1eab7e567c97bdf29ac0654864.tar.bz2
dotty-c67217594bb40e1eab7e567c97bdf29ac0654864.zip
Eliminate LambdaAbstract
Use fromParams instead.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Checking.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Inliner.scala3
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Namer.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala2
4 files changed, 6 insertions, 7 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala
index 00d36651e..5d1c44efc 100644
--- a/compiler/src/dotty/tools/dotc/typer/Checking.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala
@@ -76,7 +76,7 @@ object Checking {
val orderedArgs = if (hasNamedArg(args)) tparams.map(argNamed) else args
val bounds = tparams.map(_.paramInfoAsSeenFrom(tycon.tpe).bounds)
def instantiate(bound: Type, args: List[Type]) =
- bound.LambdaAbstract(tparams).appliedTo(args)
+ HKTypeLambda.fromParams(tparams, bound).appliedTo(args)
checkBounds(orderedArgs, bounds, instantiate)
def checkWildcardHKApply(tp: Type, pos: Position): Unit = tp match {
diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala
index 90052a1ed..f6d65fbb9 100644
--- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala
@@ -120,7 +120,8 @@ object Inliner {
// Abstract accessed type over local refs
def abstractQualType(mtpe: Type): Type =
if (localRefs.isEmpty) mtpe
- else PolyType.fromParams(localRefs.map(_.symbol.asType), mtpe).flatten
+ else PolyType.fromParams(localRefs.map(_.symbol.asType), mtpe)
+ .asInstanceOf[PolyType].flatten
val accessorType = abstractQualType(addQualType(dealiasMap(accessedType)))
val accessor = accessorSymbol(tree, accessorType).asTerm
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala
index bdf044aa8..ce2030c01 100644
--- a/compiler/src/dotty/tools/dotc/typer/Namer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala
@@ -115,7 +115,7 @@ trait NamerContextOps { this: Context =>
if (param.info.isDirectRef(defn.ObjectClass)) param.info = defn.AnyType
make.fromSymbols(params.asInstanceOf[List[TermSymbol]], resultType)
}
- if (typeParams.nonEmpty) monotpe.LambdaAbstract(typeParams.asInstanceOf[List[TypeSymbol]])
+ if (typeParams.nonEmpty) PolyType.fromParams(typeParams.asInstanceOf[List[TypeSymbol]], monotpe)
else if (valueParamss.isEmpty) ExprType(monotpe)
else monotpe
}
@@ -1151,9 +1151,7 @@ class Namer { typer: Typer =>
}
def typeDefSig(tdef: TypeDef, sym: Symbol, tparamSyms: List[TypeSymbol])(implicit ctx: Context): Type = {
- def abstracted(tp: Type): Type =
- if (tparamSyms.nonEmpty) tp.LambdaAbstract(tparamSyms) else tp
-
+ def abstracted(tp: Type): Type = HKTypeLambda.fromParams(tparamSyms, tp)
val dummyInfo = abstracted(TypeBounds.empty)
sym.info = dummyInfo
// Temporarily set info of defined type T to ` >: Nothing <: Any.
diff --git a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
index 4416428f4..fb1728578 100644
--- a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
+++ b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
@@ -460,7 +460,7 @@ trait TypeAssigner {
}
def assignType(tree: untpd.LambdaTypeTree, tparamDefs: List[TypeDef], body: Tree)(implicit ctx: Context) =
- tree.withType(body.tpe.LambdaAbstract(tparamDefs.map(_.symbol.asType)))
+ tree.withType(HKTypeLambda.fromParams(tparamDefs.map(_.symbol.asType), body.tpe))
def assignType(tree: untpd.ByNameTypeTree, result: Tree)(implicit ctx: Context) =
tree.withType(ExprType(result.tpe))