aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/ast/tpd.scala3
-rw-r--r--src/dotty/tools/dotc/typer/EtaExpansion.scala2
2 files changed, 2 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala
index b66b4d017..195797b2b 100644
--- a/src/dotty/tools/dotc/ast/tpd.scala
+++ b/src/dotty/tools/dotc/ast/tpd.scala
@@ -123,8 +123,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
* where the closure's type is the target type of the expression (FunctionN, unless
* otherwise specified).
*/
- def Closure(meth: TermSymbol, bodyFn: List[Tree] => Tree, targetType: Type = NoType)(implicit ctx: Context): Block = {
- val rhsFn: List[List[Tree]] => Tree = { case args :: Nil => bodyFn(args) }
+ def Closure(meth: TermSymbol, rhsFn: List[List[Tree]] => Tree, targetType: Type = NoType)(implicit ctx: Context): Block = {
val targetTpt = if (targetType.exists) TypeTree(targetType) else EmptyTree
Block(
DefDef(meth, rhsFn) :: Nil,
diff --git a/src/dotty/tools/dotc/typer/EtaExpansion.scala b/src/dotty/tools/dotc/typer/EtaExpansion.scala
index 26a2af231..782e5382f 100644
--- a/src/dotty/tools/dotc/typer/EtaExpansion.scala
+++ b/src/dotty/tools/dotc/typer/EtaExpansion.scala
@@ -112,7 +112,7 @@ object EtaExpansion {
def etaExpand(tree: Tree, tpe: MethodType)(implicit ctx: Context): Tree = {
def expand(lifted: Tree): Tree = {
val meth = ctx.newSymbol(ctx.owner, nme.ANON_FUN, Synthetic, tpe, coord = tree.pos)
- Closure(meth, Apply(lifted, _))
+ Closure(meth, argss => (lifted /: argss)(Apply(_, _)))
}
val defs = new mutable.ListBuffer[Tree]
val lifted = liftApp(defs, tree)