Skip to content

Commit

Permalink
Fix desugaring empty argument blocks in normArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Mar 20, 2022
1 parent ca63fc1 commit 8322bca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ trait Applications extends Compatibility {
* formal parameter that is a unary function.
*/
def normArg(alts: List[TermRef], arg: untpd.Tree, idx: Int): untpd.Tree = arg match
case Block(Nil, expr) => normArg(alts, expr, idx)
case Block(Nil, expr) if !expr.isEmpty => normArg(alts, expr, idx)
case untpd.Function(args: List[untpd.ValDef] @unchecked, body) =>

// If ref refers to a method whose parameter at index `idx` is a function type,
Expand Down
7 changes: 7 additions & 0 deletions tests/pos/i14699.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def always(block: => Unit): Unit = {}
def always(args: Int*)(block: => Unit): Unit ={}

def test =
val x = always{}
val xc: Unit = x
always(1,2,3) {}

0 comments on commit 8322bca

Please sign in to comment.