Skip to content
ZOLO / TE202 Type · error

`@strict`: parameter must have a type annotation

Strict typing requires every function parameter to have an explicit type.

Why this fires

Zolo's type checker has a Strict strictness mode that requires every function parameter to have an explicit type annotation (self is exempt). Without strict mode, an un-annotated parameter is simply gradual (any); strict mode requires you to say what it is.

fn foo(x) { return x }
// error[TE202]: strict mode: parameter 'x' must have a type annotation

Current status: zolo.toml's [compiler] type_check = "strict" field documents the intent, but as of this writing no CLI command (zolo check, zolo build, zolo run) or the LSP actually switches the type checker into Strict mode. TE202 is reachable today only through the compiler's own Rust API (zolo_compiler::compiler::type_check_with_mode(src, StrictnessMode::Strict) / compile_to_lua_with_mode), which is how the compiler's own test suite exercises it.

Fix it

Annotate the parameter:

fn foo(x: int) -> int { return x }   // ok

See also

  • TE201 — the same rule for let bindings.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br