Skip to content
ZOLO / TE164 Type · error

invalid function clause contract or coverage

Compiler diagnostic TE164: invalid function clause contract or coverage.

Consecutive function clauses must describe one callable with a shared parameter and return contract. TE164 reports a clause group that cannot establish that contract.

fn classify(0: int) -> str = "zero"
fn classify(n: int) -> str = "other"

Keep the clauses together within the same module or impl. Local fn helpers retain irrefutable parameters and do not admit clause guards. Trait declarations keep their ordinary method interface; put pattern clauses in the concrete impl. They must agree on arity, parameter types, conventions, generic parameters, public argument labels and return/effect declarations. Do not put defaults or variadic parameters in a clause group. Each clause needs a body. A dispatch across multiple parameters currently rejects transitively linear slots until the dispatch can prove a borrowed tuple representation. A guard may not consume a value needed by a later clause. Callable decorators belong to the first header; a conflicting decorator on a later header is rejected.

A label before a pattern exposes a named argument:

fn classify(value 0: int) -> str = "zero"
fn classify(value n: int) -> str = "other"
print(classify(value: 3))

An unlabeled refutable pattern makes that slot positional throughout the group; a synthetic backend name is never an accepted public label. Use the same explicit label in every clause when exposing a refutable slot by name. For identifier-only clauses, an implicit binder label and an explicit label with the same name describe the same call interface.

Patterns select clauses in written order. A boolean guard runs after its pattern matches. Use an unguarded fallback for unbounded values. Existing match diagnostics report incomplete coverage and unreachable patterns.

See the function reference and the example.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

en