diagnostic codes / Types
E0201 unknown-identifier
A name was used that nothing declares.
E0201unknown-identifierdefine it, use the right module, or fix spelling
| severity | error |
|---|---|
| band | Types |
| in the v0 bootstrap | emitted |
| explain | ralt explain E0201 |
The name-resolution pass knows every function, struct, enum, local and builtin visible at this point. A call to a function that is neither declared in the file nor in an `extern` block lands here, before any type is considered.
What it looks like
e0201.tp
use tier core; fn main() -> i32 { puts("hi"); return 0; }
ralt check e0201.tp e0201.tp:4:5: error: call to unknown function 'puts' [E0201 unknown-identifier] define it, use the right module, or fix spelling
What to do
- Declare the function in the file, or declare the C symbol in an `extern "C"` block.
- For a local, check the binding is in scope at the use site: a block-local `let` does not exist after its `}`.
- For a struct or enum, check the definition precedes the use in the file.
Why the code exists
Tripon has no implicit libc prelude. A name in the environment is a dependency, and a dependency has to be written down. That is what makes a `.tp` file's imports auditable from the file itself.
What ralt explain says
ralt explain E0201 E0201 severity: error name: unknown-identifier hint: define it, use the right module, or fix spelling
Related
- extern "C" /docs/reference/extern
- Builtins /docs/reference/builtins