New Issue: Lambda declaration without braces fails to compile.

16604, “ben-albrecht”, “Lambda declaration without braces fails to compile.”, “2020-10-21T15:20:54Z”

Summary of Problem

A lambda declaration without braces fails to compile.

It is not completely clear on the spec whether this should work, but @mppf and I consider this is a bug in the implementation.

Transferred from: Lambda with statement not block doesn't compile (originally reported by @russel)

Steps to Reproduce

Source Code:

Both the following function definitions compile fine:

proc f(n: int): int { return 1; }
proc f(n: int): int return 1;

The following lambda using a block works fine:

var f = lambda (n: int): int { return 1; };

but using just a statement causes a compilation fail:

var f = lambda (n: int): int return 1;

Configuration Information

  • Output of chpl --version: 1.23.0