diff options
author | Martin Odersky <odersky@gmail.com> | 2015-07-14 19:54:18 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-09-18 18:05:15 +0200 |
commit | f19220307f25a08269ab5098de784f023cb6b02b (patch) | |
tree | 1e76a98bc2140827ba9e89a8889eef3977b38878 /src/dotty/tools/dotc/typer/Applications.scala | |
parent | 5f7eadf3f4d4798dec7c87c92a86c882948ac3de (diff) | |
download | dotty-f19220307f25a08269ab5098de784f023cb6b02b.tar.gz dotty-f19220307f25a08269ab5098de784f023cb6b02b.tar.bz2 dotty-f19220307f25a08269ab5098de784f023cb6b02b.zip |
Adapt arguments in all type applications
Previously, we did this only in applications in rhs of type definitions.
Need to do it everywhere.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 40029c42b..8800c1a55 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -604,10 +604,6 @@ trait Applications extends Compatibility { self: Typer => val typedFn = typedExpr(tree.fun, PolyProto(typedArgs.tpes, pt)) typedFn.tpe.widen match { 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) @@ -616,6 +612,9 @@ trait Applications extends Compatibility { self: Typer => assignType(cpy.TypeApply(tree)(typedFn, typedArgs), typedFn, typedArgs) } + def adaptTypeArg(tree: tpd.Tree, bound: Type)(implicit ctx: Context): tpd.Tree = + tree.withType(tree.tpe.EtaExpandIfLambda(bound)) + /** Rewrite `new Array[T](....)` trees to calls of newXYZArray methods. */ def convertNewArray(tree: tpd.Tree)(implicit ctx: Context): tpd.Tree = tree match { case Apply(TypeApply(tycon, targ :: Nil), args) if tycon.symbol == defn.ArrayConstructor => |