0x0LearnReferenceLibrariesMigration0x0.jmp0x1b.com

Diagnostic Classes

Compiler diagnostics are allowed to differ in exact wording between independent

implementations, but user-facing failures must map to stable classes.

The current shared classes are:


PARSE          malformed source text or unmatched delimiters
SEM_DUPLICATE  duplicate source declarations
SEM_UNBOUND    unresolved source symbols
SEM_SHAPE      malformed source declarations or import/export forms
TYPE_CONTRACT  concrete type contract mismatch
TYPE_EFFECT    forbidden capability/effect boundary
TYPE_ARITY     wrong argument count for a function or builtin
BACKEND_UNSUPPORTED backend cannot lower the requested source slice yet

The main compiler and compiler2 may keep implementation-specific prefixes

such as compiler2:, line/column suffixes, or backend context. The class is

the compatibility contract used by tooling and cross-compiler tests.

make diagnostic-source-check verifies the documented class set, classifier

patterns, main compiler diagnostic strings, compiler2 diagnostic strings, and

compiler2 smoke inputs without invoking either compiler.

make diagnostic-classes-check runs actual failing inputs through both

compilers, classifies their stderr, and hashes the resulting report.

Public Triage

Use this order for public troubleshooting:

1. PARSE: check parentheses, strings, comments, and source form shape.

2. SEM_SHAPE: check top-level forms, function shape, imports, exports, and

annotation placement.

3. SEM_DUPLICATE: check duplicate function names or duplicate parameters.

4. SEM_UNBOUND: check local bindings, parameters, imports, and exported names.

5. TYPE_ARITY: check user function and builtin argument counts.

6. TYPE_CONTRACT: check concrete I64, Text, Bool, and Unit contracts.

7. TYPE_EFFECT: check pure functions and effectful calls.

8. BACKEND_UNSUPPORTED: check whether the selected backend supports the

requested source slice.

Package failures should be triaged with docs/package-system.html and

docs/packages.html. Runtime boundary failures should be triaged with the

specific runtime boundary doc for the host effect being used.