DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
B0708: an inline lambda outside a pipeline's stage or consumer
Catalog status: active. Default severity: error. Stable name: lambda-outside-stage. Family: Syntax and source text.
An inline lambda, x => x + 1, is the function of a pipeline's stage or consumer, written where it is used (see pipelines). Varc has no function values, so a lambda cannot be an ordinary argument.
Example (Varc)
fn main() {
fn twice(x: Integer) -> Integer = 2 * x;
let y: Integer = 3 |> twice(x => x + 1);
}
What to do
Pass a value, or write the lambda's body as an expression function and call it: 3 |> twice().
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See syntax and source text, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.