diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala index 43154022e3a0..1da4ed581b4d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Applications.scala +++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala @@ -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, diff --git a/tests/pos/i14699.scala b/tests/pos/i14699.scala new file mode 100644 index 000000000000..c0cc89fbf4f8 --- /dev/null +++ b/tests/pos/i14699.scala @@ -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) {}