Skip to content
ZOLO / TE142 Type · error

void conclusion used in value position

Compiler diagnostic TE142: void conclusion used in value position.

Why this fires

A ; after a block's final expression suppresses its value: the block concludes void instead of yielding the expression's result (specs/tail-value-suppression.md). void is not a value — it cannot be bound, passed as an argument, or combined with other values. TE142 fires when a void conclusion caused by an explicit terminator is used where a value is required:

fn none() { 1; }          // inferred: fn() -> void (the `;` suppresses `1`)

let b = none()            // error[TE142]: `none` concludes void because its
                          //   final expression is terminated by `;`

print(if ready { 1; } else { 2; })
                          // error[TE142]: this branch's final expression is
                          //   terminated by `;`

Only terminator-caused void is flagged. A function that is void because it simply has no trailing expression (or only bare returns) is not an error to bind — that permissiveness is unchanged.

Note the difference from nil: nil is a real value that can be stored and compared. void means "zero values". nil; evaluates the nil and then discards it, concluding void.

Fix it

1. Keep the value — remove the terminator

If the caller needs the result, the tail should not be suppressed:

fn one() { 1 }            // inferred: fn() -> int
let b = one()             // ok

The structured fix attached to this error removes exactly that ; (also available as a quick fix in the editor).

2. Keep the suppression — stop using the result

If the function really is effect-only, don't bind or pass its conclusion:

none()                    // ok: statement position, nothing consumed

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

en