aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-06-18 18:20:14 +0200
committerMartin Odersky <odersky@gmail.com>2014-06-18 18:21:07 +0200
commit7f721438b5bccc8ca9dd68cef273c8cac8199e1a (patch)
treea619fb770fee578354c7fca1f1c30c68f0d542d0 /src/dotty/tools/dotc/typer/Applications.scala
parent388d9a889c6929699e879a307dc80145b906390a (diff)
downloaddotty-7f721438b5bccc8ca9dd68cef273c8cac8199e1a.tar.gz
dotty-7f721438b5bccc8ca9dd68cef273c8cac8199e1a.tar.bz2
dotty-7f721438b5bccc8ca9dd68cef273c8cac8199e1a.zip
Handling higher-kinded types with lambdas
Switch to the new scheme where higher-kinded types (and also some polymorphic type aliases) are represented as instances of Lambda traits.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index aaceac0e0..91f4ce9a5 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -510,10 +510,17 @@ trait Applications extends Compatibility { self: Typer =>
}
def typedTypeApply(tree: untpd.TypeApply, pt: Type)(implicit ctx: Context): Tree = track("typedTypeApply") {
- val typedArgs = tree.args mapconserve (typedType(_))
+ var typedArgs = tree.args mapconserve (typedType(_))
val typedFn = typedExpr(tree.fun, PolyProto(typedArgs.tpes, pt))
typedFn.tpe.widen match {
- case pt: PolyType => checkBounds(typedArgs, pt, tree.pos)
+ case pt: PolyType =>
+ def adaptTypeArg(tree: tpd.Tree, bound: Type): tpd.Tree =
+ if (bound.isLambda && !tree.tpe.isLambda && tree.tpe.typeParams.nonEmpty)
+ tree.withType(tree.tpe.EtaExpand)
+ else tree
+ if (typedArgs.length <= pt.paramBounds.length)
+ typedArgs = typedArgs.zipWithConserve(pt.paramBounds)(adaptTypeArg)
+ checkBounds(typedArgs, pt, tree.pos)
case _ =>
}
assignType(cpy.TypeApply(tree, typedFn, typedArgs), typedFn, typedArgs)