Skip to content

Commit

Permalink
Fix eta expansion
Browse files Browse the repository at this point in the history
revios fix crashed for nullary functions
  • Loading branch information
odersky committed Dec 19, 2015
1 parent 05bc8a0 commit ded374a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dotty/tools/dotc/typer/EtaExpansion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ object EtaExpansion {
val params = (mt.paramNames, paramTypes).zipped.map((name, tpe) =>
ValDef(name, TypeTree(tpe), EmptyTree).withFlags(Synthetic | Param).withPos(tree.pos))
var ids: List[Tree] = mt.paramNames map (name => Ident(name).withPos(tree.pos))
if (mt.paramTypes.last.isRepeatedParam)ids = ids.init :+ repeated(ids.last)
if (mt.paramTypes.nonEmpty && mt.paramTypes.last.isRepeatedParam)
ids = ids.init :+ repeated(ids.last)
val body = Apply(lifted, ids)
val fn = untpd.Function(params, body)
if (defs.nonEmpty) untpd.Block(defs.toList map untpd.TypedSplice, fn) else fn
Expand Down

0 comments on commit ded374a

Please sign in to comment.