Skip to content
ZOLO / TE833 Type · error

fallible failure path is incompatible with the enclosing return type

Compiler diagnostic TE833: fallible failure path is incompatible with the enclosing return type.

Why this fires

Postfix ? and ?> return the matching nil, Option.None, or Result.Err from the enclosing function. That failure must be compatible with the function's declared return type.

fn parse() -> Result<int, str> { Result.Err("invalid") }

fn invalid() -> int {
    parse()? // error[TE833]: `Result.Err` cannot be returned as `int`
}

Option.None is not interchangeable with Result.Err, and a nilable failure is not silently boxed into either enum.

Fix it

Return a compatible fallible type, or handle the failure explicitly:

fn valid() -> Result<int, str> {
    Result.Ok(parse()? * 2)
}

Use match when translating between different failure representations.

See also

  • TE832 — the operand is not fallible.
  • TE834?? operates only on runtime nil.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

en