Appearance
Error-code reference
Every diagnostic Tantu reports carries a stable code. The prefix tells you which stage produced it:
| Prefix | Stage | When |
|---|---|---|
L### | lex | tokenizing the source (indentation, characters, string literals) |
P### | parse | building the syntax tree |
E#### | check | type checking (types, scopes, exhaustiveness, no-null, immutability) |
R### | runtime | a panic while the program runs |
Lex, parse, and check errors are compile-time (exit code 2), so the program never runs. Runtime panics (exit code 1) happen during execution and terminate the whole program with a stack trace.
| Code | Name | Stage | Meaning |
|---|---|---|---|
E0001 | unsupported | check | This construct is syntactically valid but not supported in the current build. |
E0101 | duplicate | check | A name is defined twice in the same scope. |
E0102 | assign-immutable | check | Assignment to a let binding; declare it var if it must change. |
E0103 | var-capture | check | A closure or fiber tried to capture a var; copy it into a let first. |
E0104 | non-bool-cond | check | The condition of an if/while is not a Bool. |
E0105 | non-exhaustive | check | A match does not cover every variant of the scrutinee's type. |
E0106 | question | check | ? was used on an Option inside a Result-returning function (or vice versa). |
E0107 | empty-list | check | The element type of an empty list [] can't be inferred; add an annotation. |
E0108 | missing-return | check | A function that should return a value ends in a Unit-typed statement. |
E0109 | intrinsic-not-value | check | An intrinsic (like send) was used outside call position; it is not a value. |
E0111 | unknown-name | check | A referenced name is not defined in any enclosing scope. |
E0112 | type-mismatch | check | A value's type does not match the type expected here. |
E0113 | not-comparable | check | ==/!= used on a type Tantu does not treat as comparable. |
E0114 | loop-control | check | break/continue used outside a loop. |
E0115 | unknown-type | check | A type annotation names a type that does not exist. |
E0116 | return-outside | check | return used outside a function body. |
E0117 | not-callable | check | A non-function value was called. |
E0118 | arity | check | A call passed the wrong number of arguments. |
E0119 | cannot-infer | check | A generic call is underdetermined; a type parameter couldn't be inferred. |
E0120 | unreachable | check | A match arm can never be reached (a prior arm already covers it). |
E0121 | not-a-variant | check | A pattern names a constructor that isn't a variant of the matched enum. |
E0122 | variant-arity | check | A variant pattern or constructor has the wrong number of fields. |
E0123 | constructor-not-value | check | A bare enum constructor was used as a value instead of being called/matched. |
E0124 | dup-variant | check | Two variants of an enum share the same name. |
E0130 | import-cycle | check | The module import graph contains a cycle. |
E0131 | module-not-found | check | An import names a module file that can't be found. |
E0132 | not-a-module-member | check | A qualified access mod.member names a member the module doesn't export. |
E0133 | module-not-value | check | A module name was used as a value rather than accessed with .member. |
E0134 | import-unsupported | check | import was used where there is no source file on disk (stdin/REPL). |
E0135 | select-else | check | A select's else arm must be the single, last arm. |
E0136 | generic-not-value | check | A generic function was used as a value; it is call-only; wrap it in a lambda. |
L001 | tabs-in-indent | lex | Tabs are not allowed in indentation; Tantu indents with spaces only. |
L002 | bad-dedent | lex | An unindent does not line up with any enclosing indentation level. |
L003 | illegal-char | lex | An illegal character appeared in the source. |
L004 | invalid-escape | lex | An unknown escape sequence appeared inside a string literal. |
L005 | unterminated-string | lex | A string literal was opened but never closed before end of line/file. |
L006 | invalid-number | lex | A numeric literal is malformed, for example a misplaced underscore like 1_, _5, or 1._5. |
P001 | unexpected-token | parse | An unexpected token was found where the grammar expected something else. |
P002 | unexpected-eof | parse | The source ended in the middle of a construct the parser was still reading. |
P003 | too-deep | parse | Expression, type, or pattern nesting is too deep for the parser to read safely. |
R001 | div-by-zero | runtime | Division or modulo by zero at runtime. |
R002 | index-out-of-range | runtime | A list index was out of range at runtime. |
R003 | send-closed | runtime | A send was attempted on a closed channel. |
R004 | close-closed | runtime | A channel was closed twice. |
R005 | deadlock | runtime | Deadlock: every fiber is blocked and none can make progress. |
R006 | uninit | runtime | A global was read before its initializer ran. |
R007 | match-fail | runtime | A match at runtime found no matching arm (should be prevented by the checker). |
R008 | step-limit | runtime | Execution exceeded the playground's instruction budget (runaway loop safeguard). |
R009 | builtin | runtime | A builtin hit a domain error at runtime (for example converting nan/inf to an integer). |
R010 | stack-overflow | runtime | The call stack overflowed; recursion exceeded the frame cap. |
R011 | bad-cap | runtime | A channel was created with a negative capacity. |
Generated
The code list is pulled directly from the interpreter's error registry (tantu/errors.py), so a new code can't silently go undocumented.
Many of these are explained in context: immutability and no-null (E0102, E0103, E0106, E0107) in Types & no-null, exhaustiveness (E0105, E0120) in Pattern matching, closures (E0103) in Functions & closures, generics (E0119, E0136) in Generics, and imports (E0130–E0134) in Modules.