Lyricdev
GitHub

Appendix A — Diagnostic catalogue

Generated from the toolchain's diagnostics.toml by tooling/diagnostics/appendix.py; not edited by hand. Source of the decisions: 11 Tooling and interop G9.

Every code the reference toolchain reports, with its severity, the chapter whose rule it is, and when it is reported. The code and the severity are contract; the message's wording is not (16 §1). lyric explain CODE prints a code's whole entry: its explanation, a program that reports it and the program put right. A retired code is no longer reported, and its number is not given again.

Severities: E error, W warning, H hint, P panic (at run time, exit code 101).

A.1 LEX — Lexical errors

The lexer's: a token that cannot be formed.

Code S Chapter Title When
LYR-LEX0001 E 01-lexical a character that starts no token, or a name beyond ASCII The source holds a character that begins no token ($, a backtick, a control character), or a word holding letters, digits or marks beyond ASCII. A word beyond ASCII is refused once where it stands and read as the name it would be.
LYR-LEX0002 E 01-lexical a block comment that is not closed A /* comment runs to the end of the file without its */. Block comments nest, so a /* inside one needs its own */ as well.
LYR-LEX0003 E 01-lexical a numeric literal with a suffix that does not fit it A number carries a suffix that is no type's (10i7), an integer suffix on a float literal (1.5u8), or a float suffix on a literal with a base prefix (0b1f32).
LYR-LEX0004 E 01-lexical a base prefix with no digits after it A literal is written 0x, 0o or 0b and no digit of that base follows the prefix.
LYR-LEX0005 E 01-lexical a digit separator right after a base prefix A literal with a base prefix has _ directly after the prefix, as in 0x_FF.
LYR-LEX0006 E 01-lexical an exponent with no digits A decimal literal has an e or E, perhaps with a sign, and no decimal digit after it: 1e, 2.5e+.
LYR-LEX0007 E 01-lexical a malformed escape sequence A string, character or f-string holds a \ that starts no escape (\q), a \x without two hex digits, or a \u that is not \u{…} with one to eight hex digits naming a Unicode scalar value (at most 10FFFF, no surrogate).
LYR-LEX0008 E 01-lexical a character literal that holds no character or several Between the quotes of a character literal stand no characters ('') or more than one ('ab'). An escape counts as one.
LYR-LEX0009 E 01-lexical a string literal that is not closed A string, raw string or byte string reaches the end of its line or of the file without its closing quote; a multi-line string """… reaches the end of the file without its closing """.
LYR-LEX0010 E 01-lexical a character literal that is not closed A character literal reaches the end of its line or of the file without its closing '.
LYR-LEX0011 E 01-lexical an f-string that is not closed An f-string reaches the end of its line (or, for f""", of the file) without its closing quote — also when the line ends inside an interpolation or its format spec.
LYR-LEX0012 E 01-lexical a byte string holding no byte, or an '@' without a name A byte string b"…" holds a character beyond ASCII or a \u{…} escape, which name characters and not bytes; or an @ is followed by neither a name nor [.
LYR-LEX0013 E 01-lexical a byte escape in a string or character A string, character literal or f-string holds the escape \xNN, which writes a byte and stands in a byte string b"…" only.
LYR-LEX0014 E 01-lexical a multi-line string whose quotes do not stand on lines of their own A multi-line string """…""" has text on the line of its opening """, or text before its closing """ on the closing line.
LYR-LEX0015 E 01-lexical a line of a multi-line string indented less than its closing quotes A line of a multi-line string (or a multi-line f-string) does not begin with the indentation of the line that holds the closing """. A blank line may be indented less.
LYR-LEX0016 E 01-lexical a float literal without digits on one side of its point A float literal is written 1. or .5. Each is refused once and read as the float it means.

A.2 PAR — Syntax errors

The parser's. A declaration that does not parse reports these and nothing that follows from them (16 §2).

Code S Chapter Title When
LYR-PAR0001 E 02-grammar a token after one whole expression, pattern or statement (retired) The parser was asked for exactly one expression, pattern or statement, and a token follows it. Retired: Lyric 5 parses a file whole; the single-item entry points that report it serve std.syntax and a macro's read-back, which turn any parse error into LYR-CT0001 or an internal error
LYR-PAR0002 E 02-grammar an expression is missing An expression is needed — after =, as an argument, an operand, a returned value — and the token there begins none.
LYR-PAR0003 E 02-grammar a member name or a compile-time form is incomplete A . or ?. is followed by no member name (or by a number that is no tuple position), or the parts of a compile-time form are missing: the parentheses of comptime if or comptime for in an initializer, the ] of e.[f], the field and = of a with.
LYR-PAR0004 E 02-grammar a ']' is missing A [ is not closed: an array literal, an index, an array pattern, an array type, a throws or catch list, a type set in a pattern, a constraint or conformance list, a bound, or T.[f].
LYR-PAR0005 E 08-expressions range operators chained A range a..b or a..=b is followed by another range operator, as in 1..5..9.
LYR-PAR0006 E 01-lexical a numeric literal with an unknown suffix A numeric literal ends in letters that are no suffix. The lexer refuses such a literal first (LYR-LEX0003, LEX0004, LEX0006), so this code comes only together with that one.
LYR-PAR0007 E 01-lexical a numeric literal too large An integer literal does not fit in 64 bits, or a float literal is beyond the range of float.
LYR-PAR0008 E 02-grammar a parenthesis is missing A ( or ) the construct needs is missing: a call, a grouping, a tuple, a parameter list, a function type, the condition of if or while, a for header, a catch binding, a pattern.
LYR-PAR0009 E 02-grammar an angle bracket of a type list is missing A list of type arguments <…> or of type parameters is not closed by >.
LYR-PAR0010 E 03-types a tuple of fewer than two elements, or a label given twice A tuple literal or tuple type is written with one element and a comma, (1,), or a tuple type gives the same label to two elements.
LYR-PAR0011 E 02-grammar a type is missing A type is needed — after :, in a type argument list, after as or is — and the token there begins none; or a dotted type path ends in something else than a name.
LYR-PAR0012 E 08-expressions a lambda without '=>' before its body A lambda's parameters, or its parameters and return type, are not followed by =>; or the parameters of a trailing block { a, b => … } are not.
LYR-PAR0013 E 08-expressions a lambda parameter without a name Where a lambda's parameter name belongs stands something else — a literal, or a reserved word, which is then read as the name it was meant to be.
LYR-PAR0014 E 08-expressions an interpolation not closed by '}' In an f-string, the expression of an interpolation {…} is followed by something else than its } or its format spec :…} — a second expression, a stray ), or the end of the line.
LYR-PAR0015 E 03-types a function type without '->' A function type fn(…) is not followed by -> and its return type.
LYR-PAR0016 E 07-statements a ';' is missing A statement is not ended by ;; a function has neither a body { … } nor a ;; an extern declaration is not ended by ;. Within a statement block, a value without ; before the end of a block is refused too.
LYR-PAR0017 E 07-statements a '{' is missing, or a body without braces The body of if, else, while, do or for is a single statement without braces, or a block, a match body, or the body of a struct, class, enum, interface or extend does not open with {.
LYR-PAR0018 E 02-grammar a '}' is missing A { is not closed by its }: a block, a match body, a declaration's body, an initializer, a with, an import list, attribute arguments, a quote or splice, a trailing block — or the ) of an attribute's one value is missing.
LYR-PAR0019 E 07-statements a '(' is missing after a keyword if, while, for, match or catch is not followed by (, or a function's name is not followed by its parameter list.
LYR-PAR0020 E 07-statements a binding without its name, pattern or value A let, var, loop variable or catch binding has no name (a reserved word stands there, read as the name); a pattern binding or destructuring has no = and value; a let condition has no =; or a module-level or static binding takes a pattern.
LYR-PAR0021 E 07-statements a for loop without 'in' The header of a for loop has its variable or pattern but no in before what it walks.
LYR-PAR0022 E 07-statements a do block without 'while' The block of a do loop is not followed by while and its condition.
LYR-PAR0025 E 02-grammar something else than a declaration at module level At the top level of a file stands a token that begins no declaration — a statement, an expression, a stray brace. The parser skips to the next declaration.
LYR-PAR0026 E 02-grammar a name is missing Where a declaration, a parameter, a field, a variant, a type parameter, an attribute, an import item or a path segment is named, no name stands — or a reserved word, which is then read as the name; an import list { } names nothing; a bare ... closes the parameters of a function that is no extern "C" one.
LYR-PAR0028 E 03-types a type alias without '=' A type or opaque type declaration names the alias, and its type parameters, but no = follows.
LYR-PAR0029 E 03-types fields of a struct or class without ',' between them In the body of a struct or class, a field is followed by another member without a , between them.
LYR-PAR0030 E 05-interfaces a list after '::' without its '[' (retired) The interfaces after :: did not open with [. Retired: the list rule: one interface after '::' stands without brackets, 'struct S :: I'; several without them are LYR-PAR0066
LYR-PAR0031 E 02-grammar a parameter or field without ':' before its type A function's parameter or a field of a struct, class or variant is named, and no : follows before its type.
LYR-PAR0032 E 03-types a function without 'fn', or its words out of order Where a function or method is declared, fn is missing after its other words, or inline static is written where the order is static inline; an extern block declares no function.
LYR-PAR0033 E 09-patterns a malformed pattern Where a pattern stands, the token begins none; a - in a pattern is not followed by a number; a range pattern's bound is no literal; or an array pattern holds two rests ...
LYR-PAR0034 E 09-patterns a match arm without '=>' A match arm's pattern, or its guard, is not followed by =>.
LYR-PAR0035 E 09-patterns match arms without ',' between them A match arm whose body is an expression is followed by another arm without a ,.
LYR-PAR0036 E 08-expressions an if expression without 'else' An if in expression position — after =, as an argument, without braces around its branch — has no else branch.
LYR-PAR0037 E 03-types a field in an initializer without '=' In a struct initializer, in the braces of an attribute, or after [f] in an initializer over infos, a field's name is not followed by =.
LYR-PAR0041 E 05-interfaces a static member in an interface (retired) An interface member is declared static. Retired: In Lyric 5 an interface declares static members, which a constraint reaches, and every member sequence admits static
LYR-PAR0042 E 11-metaprogramming an attribute with no declaration to carry it An attribute stands at the end of a file, before something that is no declaration, before an import, or before an extern block, whose functions carry their own.
LYR-PAR0043 E 03-types an inline array of no positive literal length An inline array type T[n] gives a length that is not a positive decimal literal: int[0], int[0x4].
LYR-PAR0044 E 13-abi an extern symbol that is not a string An extern declaration has = after its signature, and no string literal follows to name the symbol.
LYR-PAR0045 E 02-grammar nesting deeper than the parser carries Expressions or types in a file nest deeper than this implementation parses — 192 levels of parentheses, brackets, operands or type arguments. Reported once, and the file is then read as holding no declaration.
LYR-PAR0046 E 07-statements a label on something that is no loop A label name: stands before a statement that is not while, do, for or loop.
LYR-PAR0047 E 05-interfaces 'by' where nothing is delegated An entry of the interface list of an enum, of an interface's parents, or of an extend block names a field to delegate to with by.
LYR-PAR0048 E 05-interfaces 'sealed' before something that is no interface The word sealed stands before a struct, class, enum, function or other declaration that is not an interface.
LYR-PAR0049 E 06-errors several types not in brackets, or an empty type list Several types follow throws, or a catch binding's : or in, without brackets around them; or a bracketed list after throws, catch (e in …) or a pattern's in is empty.
LYR-PAR0050 E 06-errors a 'try' that changes the value, not at the start try? or try!, or a try with catch clauses, stands to the right of an operator instead of at the start of the expression it covers.
LYR-PAR0051 E 06-errors a 'catch' clause on 'try?' or 'try!' A try? or try! expression is followed by catch clauses.
LYR-PAR0052 E 06-errors a 'using' that is not one 'let' with a value using var is written, or a using binding takes a pattern or has no value.
LYR-PAR0053 E 04-modules a visibility word where none or another belongs A declaration or member has two visibility words (pub private), an enum variant has one, or an import has one other than pub.
LYR-PAR0054 E 08-expressions '&' outside an argument The mark & stands before an operand that is not an argument of a call — in a binding, an operation, a returned value.
LYR-PAR0055 E 03-types an initializer at the start of a statement A statement begins with Name { … } whose braces read as an initializer's: Point { x = 1 };, or a call with a trailing block whose assignment lost its ;, run { total = 5 }.
LYR-PAR0056 E 06-errors a 'throws' behind a function type that is a return type A declaration's or lambda's return type is a function type without parentheses, followed by throws: fn make(): fn() -> int throws E.
LYR-PAR0057 E 03-types an enum's variants not ended by ';' before its members In an enum body a member — fn, static, an attribute, type Item = — stands where the next variant's name is expected: the ; after the variants is missing.
LYR-PAR0058 E 03-types '&' before a lambda parameter's pattern A lambda parameter written as a pattern in parentheses carries the place mark &: (&(a, b)) => ….
LYR-PAR0059 E 08-expressions comparisons or equalities chained A comparison (<, <=, >, >=, in, not in) is followed by another one, or == or != by another, as in a < b < c or a == b == c.
LYR-PAR0060 E 03-types a local function that is not one plain closure A fn declared inside a function body has type parameters, a parameter with a default value or a variadic parameter, or has no body.
LYR-PAR0061 E 11-metaprogramming a 'comptime if' in expression position without 'else' A comptime if (c) a stands where a value is taken and has no else branch.
LYR-PAR0062 E 11-metaprogramming a 'comptime for' in an initializer without '[f] = e' In an initializer, a comptime for (f in …) is followed by something else than an item [f] = e.
LYR-PAR0063 E 11-metaprogramming 'quote' without a block The word quote is not followed by {.
LYR-PAR0064 E 16-diagnostics a field that ends with ';' A field of a struct or class, or a field of an initializer, ends with ; where its list separates with ,; read as the , it stands for.
LYR-PAR0065 E 16-diagnostics a 'continue', 'break' or 'return' where a value stands A jump stands where an expression is wanted — a match arm, a branch of an if expression —; it is a statement and goes in a block, => { continue; }.
LYR-PAR0066 E 05-interfaces several interfaces after '::' without brackets Several interfaces follow :: — of a struct, class, enum, interface or extend block, or of an associated type's bound — without brackets around them. One interface stands without them, several in them.
LYR-PAR0067 E 13-abi an 'unsafe' block where a value stands unsafe { … } stands where an expression is wanted — after =, after return, as an argument —; it is a statement and gives no value.

A.3 RES — Names and modules

The resolver's: what a name, an import or a module path refers to.

Code S Chapter Title When
LYR-RES0001 E 04-modules a name declared twice in one scope Two declarations take the same name in one scope: a module, a type's members, an extend block, an import beside a declaration, an import written twice, or a parameter list. The second is reported; the first stays.
LYR-RES0002 E 04-modules a type name that names no type A type annotation names a type that is neither declared in the module, imported, a builtin, nor passed on by the prelude.
LYR-RES0003 E 04-modules an import of a module that does not exist An import names a module that no file provides: no src/<path>.lyr in the package, no module of a dependency or of std by that path.
LYR-RES0004 E 04-modules an imported name the module does not declare A selective import import m { x }; asks for a name the module m neither declares nor passes on with pub import.
LYR-RES0005 E 04-modules modules that import each other The imports of the program's modules form a cycle: a module imports, directly or through others, a module that imports it.
LYR-RES0006 E 04-modules a file whose module header disagrees with its path (retired) A file loaded for an import declared, in its module header, a different module than the path it was found at. Retired: Lyric 5.0: a module is named by its path alone and the module header is refused (LYR-RES0008), so a header can no longer disagree with the path
LYR-RES0007 E 04-modules two files that are the same module Two source files of a package map to the same module path, for example src/geo/point.lyr and src/geo.point.lyr, which are both app.geo.point. Reported where every file of the package is compiled: when a library is built, and by lyric test.
LYR-RES0008 E 04-modules a module header A file begins with a module header that names a path: module tools.gen;.
LYR-RES0009 E 04-modules a name the place may not see A use or an import reaches a declaration its visibility hides from this place: a private name from another module, an internal name from another package, a hidden field, or another module's import.
LYR-RES0010 E 04-modules a pub import of a name that is not pub A pub import passes on a name that is not pub where it is declared.
LYR-RES0011 E 04-modules a declaration that takes a builtin type's name A top-level declaration is named like a builtin type: struct int, fn string().
LYR-RES0012 E 04-modules a name that is also a submodule A module declares or imports a name that is also the last segment of one of its submodules: http in app.net beside the file src/net/http.lyr. Reported whether or not the submodule is imported.
LYR-RES0013 E 15-project a single file named std.lyr A file built by itself, outside a package, is named std.lyr: its module would be named std.
LYR-RES0014 E 15-project an import of a package the manifest does not declare A module imports from a package that its own package's lyric.toml does not list under [dependencies], such as a dependency of a dependency.
LYR-RES0015 E 15-project a test module under both src/tests/ and tests/ lyric test finds the same test module twice: as src/tests/<name>.lyr and as tests/<name>.lyr. Both are the module <package>.tests.<name>; the run stops before anything is compiled.
LYR-RES0016 E 15-project a module made from a C header lies in the package's source too Reported when the module a bindings entry makes — geo in app is app.geo — is also a file under the package's src/, gen/ or tests/: one module path would name two modules. Nothing is built; the exit code is 1.

A.4 SEM — Semantic errors and warnings

The checker's: types, interfaces, errors, patterns, and the warnings.

Code S Chapter Title When
LYR-SEM0001 E 03-types a value of another type than the place takes An expression's type does not fit where it stands: an initializer, an argument, a return value, an assignment.
LYR-SEM0002 E 04-modules a name that nothing in scope declares An identifier in an expression names no local, parameter, function, global or imported item visible at that point. The message may carry a did-you-mean note.
LYR-SEM0003 E 03-types an operator its operands do not provide An operator is applied to a type it is not defined for: arithmetic on a bool or char, < on a type without Ordered, + on a type without the operator interface, same on values that are not references, or a compound assignment through an operator interface on a field or element.
LYR-SEM0004 E 07-statements a condition that is not a bool The condition of an if, while, do … while or a guard has a type other than bool.
LYR-SEM0005 E 03-types a null operator on a value that is never null A force-unwrap !, a ?? or a ??= is applied to a type that is not optional, so the null case it handles cannot happen. A bare type parameter counts as not optional.
LYR-SEM0006 E 03-types a conversion that does not exist An as between types it does not convert (it converts numbers only, and char to and from uint32), or an f-string hole whose value has no Display conformance or carries a format specifier Display does not take.
LYR-SEM0007 E 03-types a value that cannot be indexed or iterated An index whose type is not int (or an integer type that widens to it), an index or range on a type that provides none, or a for over a value that is not an Iterable.
LYR-SEM0008 E 05-interfaces this outside a method The keyword this appears where there is no receiver: in a free function or in a module-level initializer.
LYR-SEM0009 E 08-expressions array elements of different types An array literal without an expected type has elements whose types differ from the first element's.
LYR-SEM0010 E 07-statements a binding whose type nothing fixes A local, global or static binding has neither a declared type nor an initializer, or its only initializer is null or [], which fix no type on their own. A static member of an interface without a type is reported here too.
LYR-SEM0011 E 03-types a name in type position that is no type A type name, an initializer T { … } or an attribute names something that is not a type, or nothing at all. A non-type name before braces is also reported here, since the braces then read as an initializer's fields.
LYR-SEM0012 E 05-interfaces a member the type does not have A member access x.name names no field, method or element of the value's type, or reads a member that is a method without calling it (length instead of length()). A tuple position past its last element is reported here too.
LYR-SEM0013 E 08-expressions a call on something that is not a function A call f(…) whose callee is not a function value: a number, a field that is no function, or a type T(…) that declares no static fn new.
LYR-SEM0014 E 08-expressions a call with the wrong number of arguments A call gives fewer arguments than the function's required parameters or more than it takes, or a call with named arguments leaves out a parameter that has no default.
LYR-SEM0015 E 03-types a field the type does not declare An initializer T { name = … }, a struct variant's initializer or a field pattern names a field that the struct, class or variant does not declare.
LYR-SEM0016 E 08-expressions branches whose types do not unify The branches of an if expression, the arms of a match expression, the parts of a try expression or the yields and returns of an inferred lambda produce types that have no common type.
LYR-SEM0017 E 07-statements a path of a function that returns no value A function whose return type is not void has a path that reaches the end of its body without a return or a throw. A function returning never whose body can end, and a coroutine whose result is not returned on every path, are reported here too.
LYR-SEM0018 E 07-statements a variable read before it is surely assigned A local declared without an initializer is read on a path where no assignment has reached it.
LYR-SEM0019 E 03-types a write to something that cannot be written An assignment, ++/--, an index write or a call of a mut fn targets something that is not a writable place: a let, a parameter, a field without var, a temporary, a module let, a value reached through a let or through an optional chain.
LYR-SEM0020 E 05-interfaces a conformance that leaves an interface member unimplemented A type or a conformance block declares an interface but does not implement one of its abstract methods, or does not answer one of its static lets.
LYR-SEM0021 E 04-modules a missing, duplicated or malformed main The entry module has no main, declares it twice, or declares it with parameters or with a return type other than void or int.
LYR-SEM0022 E 07-statements an expression statement without an effect A statement consists of an expression whose value is discarded and which does nothing else: a literal, a name, an arithmetic expression, a with. Only calls, assignments, ++/--, throw and loops stand alone.
LYR-SEM0023 E 05-interfaces a mut function that has nothing to write mut is written on a free function, which has no receiver, or on a method of a type that has no var field and whose body does not replace this (unless an interface demands the method as mut).
LYR-SEM0024 E 08-expressions a variadic parameter out of place A variadic parameter name: T... is not the last parameter or has a default, or a parameter is written with Lyric 4's params.
LYR-SEM0026 E 03-types the wrong number of type arguments A generic type, alias or function is given more or fewer type arguments than it declares type parameters (after defaults), or a function that is not generic is given type arguments.
LYR-SEM0027 E 05-interfaces a member of a type parameter that no constraint provides A generic body uses a member on a value of a type parameter (or of an associated type) that none of the parameter's constraints, and no blanket block they admit, declares.
LYR-SEM0028 E 05-interfaces a type argument that does not satisfy its constraint A type argument, written or inferred, does not conform to an interface its type parameter is constrained by.
LYR-SEM0029 E 09-patterns a pattern that cannot match the scrutinee's type A pattern's shape does not fit the scrutinee's type: null against a non-optional, a literal or range of another type, a tuple pattern of another arity, an array pattern against a non-array, or a dotted variant path against a type that is not an enum.
LYR-SEM0030 E 06-errors a thrown, declared or caught type that is not an Error A throw throws a value, a throws clause lists a type, or a catch names a type that does not conform to Error.
LYR-SEM0031 E 09-patterns an enum variant used against its shape A variant is constructed or matched in a form its declaration does not have: a struct variant called like a function, a tuple variant built with braces, a payload pattern on a variant without one, or a variant name the enum does not declare.
LYR-SEM0032 E 09-patterns or-pattern alternatives that bind differently The alternatives of an or-pattern p \| q do not bind the same names, or bind one name at different types.
LYR-SEM0033 E 08-expressions a block that gives no value where one is wanted A block that stands where a value is wanted — an arm of a match expression beside arms that give values, a clause of a try expression, a block expression — ends without a tail expression and does not leave on every path.
LYR-SEM0034 E 06-errors an error that nothing handles A call, throw or other site may throw an error type that no surrounding catch takes and the enclosing function's throws does not declare. In a lambda, an initializer or a detached body, where nothing can be declared, the error has to be caught there.
LYR-SEM0035 E 06-errors a catch-all clause before another clause A catch clause without a type, which takes every error, is followed by further catch clauses.
LYR-SEM0036 E 06-errors a try block without a catch A try { … } block statement has no catch clause.
LYR-SEM0038 E 10-concurrency a bare yield in a coroutine that yields values A yield; without a value stands in a coroutine whose yield type is not void.
LYR-SEM0039 E 10-concurrency a value returned from a coroutine that returns nothing A return v; with a value stands in a coroutine whose type gives no result, Coroutine<Y> rather than Coroutine<Y, R>.
LYR-SEM0042 E 05-interfaces an implementation that does not match the interface's signature A method or static that implements an interface member differs from the member's declaration: in parameters, return type, mut, static, place parameters, the errors it throws, or the answer it gives an associated type the interface fixes.
LYR-SEM0043 E 05-interfaces one member defaulted by two interfaces A type conforms to two interfaces that both provide a default for a member of one name, and the type implements the member itself nowhere.
LYR-SEM0045 E 03-types a lambda parameter whose type nothing gives A lambda parameter has no written type and the lambda stands where no function type is expected, or a trailing lambda's implicit it stands where the expected function does not take exactly one parameter.
LYR-SEM0046 E 10-concurrency a lambda that can end without its value A block lambda whose result is not void — a generator lambda with a result, or a lambda an inline function sets in place — has a path that ends its body without returning the value.
LYR-SEM0047 E 05-interfaces an extend target or conversion not supported An extend block targets an inline array T[N], or something that is no named type and no built-in constructor.
LYR-SEM0050 E 09-patterns a match that does not cover every value The arms of a match leave values of the scrutinee's type unmatched: a variant, null, a conformer of a sealed interface, a length class of an array, or the rest of an open type. The message names a missing pattern. Guarded arms do not count.
LYR-SEM0051 E 13-abi a function without a body A function declaration outside the standard library has no body and is not an extern declaration.
LYR-SEM0052 E 03-types a type, module or generic function used as a value A name that is not a value — a type, a module, an interface — stands where a value is wanted, or the bare name of a generic function is used as a function value.
LYR-SEM0053 E 11-metaprogramming an attribute used as an expression An @Name stands where an expression is expected. Attributes describe the declaration they precede and have no value.
LYR-SEM0054 E 03-types a static member declared 'mut' A member function is declared both static and mut.
LYR-SEM0055 E 04-modules a member that needs a receiver named without one A method or field of a type is named bare inside the type (without this.), an instance member is reached through the type, or a static member through a value; a variant is named bare inside its enum.
LYR-SEM0056 E 03-types a value type that contains itself A struct or enum holds itself by value — directly or through other structs, enum payloads, optionals or tuples — and would have infinite size.
LYR-SEM0057 E 04-modules a global read before it is initialized The initializer of a module-level binding reads a global of the same module that is declared after it.
LYR-SEM0058 E 09-patterns a destructuring that does not fit the value A let (a, b) = … takes apart a value that is not a tuple, or binds a different number of names than the tuple has elements.
LYR-SEM0059 E 05-interfaces an equality, null or membership test the type does not support ==/!= is applied to a type without Equatable or to an optional, == null to a value that can never be null, or in/!in to a container without Contains<T>.
LYR-SEM0060 E 03-types a type argument nothing determines A generic call leaves a type argument that neither the arguments nor the expected type determine, or an empty [] stands where nothing gives it an element type.
LYR-SEM0061 E 03-types a host type constructed in the program (retired) An initializer builds a host type — a field-less class of a native module — which only the host can create. Retired: Lyric 5 has no host types
LYR-SEM0062 E 08-expressions '?.' calling a field that holds a function a?.f() is written where f is a field of function type, not a method.
LYR-SEM0063 E 03-types a generic type named without its type arguments A static member, constant or variant of a generic type is reached through the bare type name, where nothing supplies the type arguments.
LYR-SEM0064 E 03-types a type alias that expands to itself A type alias names itself in its own definition, directly or through other aliases.
LYR-SEM0065 E 11-metaprogramming an attribute that cannot stand here An @Name names something that is not a struct, names a generic struct, or names a struct whose markers do not admit the declaration it sits on.
LYR-SEM0066 E 11-metaprogramming an attribute argument that is not a compile-time value (retired) A field of an attribute is set to an expression that is not a literal, a unit variant or a constant. Retired: A Lyric 5 attribute's value is computed while the program compiles
LYR-SEM0067 E 11-metaprogramming an attribute on a generic declaration An attribute other than a compiler instruction sits on a generic function or type.
LYR-SEM0068 E 11-metaprogramming an attribute repeated on one declaration The same attribute type sits on one declaration twice, under any spelling.
LYR-SEM0069 E 11-metaprogramming an attribute field left without a compile-time value (retired) An attribute use leaves a field unset whose declaration has no literal default. Retired: A Lyric 5 attribute is checked as the struct initializer it writes, and a missing field is LYR-SEM0106 there
LYR-SEM0070 E 03-types a field written twice in one initializer or 'with' A struct, class or variant initializer, an attribute, or a with copy names the same field more than once.
LYR-SEM0071 W 07-statements a local that is never used A local binding, loop variable, catch binding or pattern binding is never read after it is declared.
LYR-SEM0072 W 04-modules an import that is never used A name an import binds is never referred to in the file.
LYR-SEM0073 W 07-statements an unreachable statement A statement follows one that always leaves the block (return, throw, break, continue, a panic) and can never run; reported once per block.
LYR-SEM0074 E 05-interfaces a static extension called on a value A static function added by an extend block is called through a value instead of through the type.
LYR-SEM0075 W 07-statements a 'var' that is never reassigned A var with an initializer is read but never reassigned, written through, or used for a mut fn call; let would do.
LYR-SEM0076 W 11-metaprogramming a use of a deprecated declaration A declaration or module marked @Deprecated is used or imported outside another deprecated declaration.
LYR-SEM0077 W 04-modules an import that shadows a builtin type An import binds a name that is also a builtin type, such as import std.string; binding string.
LYR-SEM0078 E 05-interfaces a conformance or parent list entry that does not fit A :: list of a type, an extend block or an interface names something that is not an interface, repeats an entry, or makes an interface inherit itself; an associated type's or a type parameter's bound names a non-interface, or a type parameter repeats a bound.
LYR-SEM0079 E 05-interfaces an interface member inherited twice or redeclared An interface inherits a method of one name from two different parents, or declares a member with the name of one it inherits.
LYR-SEM0081 E 11-metaprogramming a deprecation whose release has come or that names no version The until of a @Deprecated is not a version (major.minor[.patch]), or names a release the toolchain has reached.
LYR-SEM0082 E 05-interfaces a member replacing a generic default of a generic interface A conformer declares its own version of a generic method that a generic interface provides as a default.
LYR-SEM0083 E 05-interfaces an operator with two conformances that fit the operand An arithmetic operator finds two conformances of the left operand's type to its interface (Mul<int32>, Mul<int16> …) that both take the right operand, with different implementations.
LYR-SEM0084 E 10-concurrency 'throws' on a type that is no coroutine or task A type written T throws E where T is neither a coroutine nor a task type.
LYR-SEM0085 E 08-expressions two functions of one name taking the same number of arguments Two functions or methods of one name in one scope can take the same number of arguments, counting the ranges their defaults allow.
LYR-SEM0086 E 08-expressions a call that more than one function of the name fits A call's name reaches several functions — for example the same name imported from two modules — and more than one takes the number of arguments passed.
LYR-SEM0087 E 08-expressions a call that no function of the name takes A name shared by several functions is called with a number of arguments none of them takes.
LYR-SEM0088 E 05-interfaces an overloaded interface member An interface declares two members of the same name.
LYR-SEM0089 E 08-expressions a shared function name used as a value without a type to choose by The bare name of several functions stands where a value is wanted, and no expected function type picks exactly one of them.
LYR-SEM0090 E 03-types a range value without std.core's 'Range' (retired) A range expression is used as a value while Range/RangeInclusive of std.core is not loaded. Retired: lyric5 always loads std.core, which declares 'Range' and 'RangeInclusive'; no program reaches the check
LYR-SEM0091 E 07-statements a loop over optional elements without the iterator protocol (retired) A for loop walks elements of an optional type through a path where the end of the walk is signalled by null. Retired: Lyric 5's protocol has '??T' and walks arrays by index
LYR-SEM0092 E 05-interfaces inference through a type that conforms twice A generic call infers a type argument from an argument's conformance to an interface, and the argument's type conforms to that interface more than once with different type arguments.
LYR-SEM0093 E 03-types an opaque type made outside its module (retired) A cast turns a value of the underlying type into an opaque alias outside the module that declares the alias. Retired: Lyric 5 has no 'opaque type' (LYR-SEM0175 refuses the declaration), so no program reaches the cast check without that error
LYR-SEM0094 E 11-metaprogramming a parenthesized attribute value with no one field to fill An attribute is written @Name(value), but its struct does not have exactly one field without a default, or the use also names fields.
LYR-SEM0095 E 11-metaprogramming an attribute whose 'WithArg' promise its first field breaks (retired) A struct declares WithArg<T> but has no field, or its first field is not of type T. Retired: std.core of Lyric 5 declares no 'WithArg'; the parenthesized form fills the one field without a default (LYR-SEM0094)
LYR-SEM0096 E 11-metaprogramming an attribute with a field a metadata row cannot hold (retired) An attribute's struct has a field whose type is not a number, string, char, bool or unit enum. Retired: A Lyric 5 attribute's value is a struct computed at compile time, not a metadata row
LYR-SEM0097 E 09-patterns a name bound twice in one pattern One pattern binds the same name in two places, such as .Rect { w = n, h = n } or E.B(x, x).
LYR-SEM0098 E 09-patterns a refutable pattern without a path for a miss A let pattern that can fail has no else, the else of a let … else does not leave on every path, a for head or lambda parameter has a refutable pattern, or a let condition stands outside an if/while head.
LYR-SEM0099 E 13-abi an extern declaration that cannot cross into C An extern function names an ABI other than "C", a symbol that is no C name, type parameters, throws, a place parameter, or a parameter or return type that does not cross into C; a bare ... with no parameter before it, or a variadic argument of a type that does not cross; a C function type, extern "C" fn(…), whose parameters or result do not cross, that throws, or that names another ABI; a Callback whose type is no C function's, or has no userdata Ptr<void> as its first or last parameter; a GcHandle of a value that is no object of a class; @Layout stands where C cannot lay the type out, or in another form than @Layout(C) or an integer type; or a variant is given an integer outside an enum with @Layout, one that is no integer literal, one its integer type does not hold, or one another variant already is.
LYR-SEM0100 E 11-metaprogramming a 'comptime' form that cannot be evaluated while compiling A 'comptime' expression, 'comptime if' or 'comptime for' asks for something the compiler cannot compute and keep as a constant: a result that is no literal (an object of a class), a read of 'this' or of a local of the enclosing function, an assignment to anything it does not bind itself, a 'comptime for' over something other than an array, a 'comptime if' with a 'let' condition or with arms of two types.
LYR-SEM0101 E 07-statements a jump to a label no enclosing loop carries A 'break' or 'continue' names a label that no loop around it carries — usually a misspelling, or a label of a loop the statement does not stand in.
LYR-SEM0102 E 07-statements a label that repeats the label of an enclosing loop A loop is labeled with a name a loop around it already carries.
LYR-SEM0103 W 07-statements a loop label nothing jumps to A loop carries a label, and no 'break' or 'continue' in its body names it.
LYR-SEM0104 W 09-patterns a pattern that cannot fail where a test is promised The pattern of an 'if (let …)', 'while (let …)' or the 'let … else' form matches every value of the type it is given, so the test never fails ('if let', 'while let') or the 'else' never runs.
LYR-SEM0105 E 16-diagnostics an expression or type nested deeper than the checker walks An expression or a type is nested deeper than the type checker's fixed bound (192 levels) — for example a chain of a few hundred binary operators, which the parser reads in a loop and the checker walks recursively.
LYR-SEM0106 E 03-types an initializer that omits a field without a default A struct, class or enum-variant initializer leaves out a field that has no default; all missing fields are named in one message.
LYR-SEM0111 E 09-patterns a bare name in a pattern that spells a variant of the scrutinee's enum A pattern binds a bare name, and the scrutinee's enum has a variant of that name — the pattern would match every value, not the variant.
LYR-SEM0112 W 09-patterns a match arm no value can reach An arm of a 'match' stands after an arm that already matches every value, or tests the same variant or literal as an unguarded arm above it.
LYR-SEM0113 E 03-types an implicit member where no enum is expected An implicit member '.Name' or an implicit variant initializer '.Name { … }' stands where the position expects no particular type, a type that is no enum, or an enum without a variant of that name.
LYR-SEM0114 E 03-types a from-the-end index '^n' outside the place it means something '^n' stands outside '[…]' as a value of its own, indexes a string directly, or indexes a value that has no length.
LYR-SEM0115 E 03-types a view of an inline array that lies in a frame A view ('Slice') of an inline array 'T[n]' is taken — by slicing it, passing it as a view, or calling a member written for views — where the array is a local, a parameter or a field of a struct local, not in the heap.
LYR-SEM0116 E 03-types 'with' on something other than a struct The target of 'with' is not a struct — a class, a tuple, another type — or a path inside its field list reaches through a field that is no struct.
LYR-SEM0117 E 03-types the placeholder type '_' where nothing infers it The placeholder '_' is written as a type, or as a type argument outside a call or initializer that infers it — for example in the type of a binding.
LYR-SEM0118 E 04-modules a visibility word on an interface member A member of an interface carries 'pub' or 'internal', or 'private' on a requirement without a body.
LYR-SEM0119 E 08-expressions a named argument that does not fit the parameters A call's named arguments are wrong: a name no parameter has, a parameter given twice or already set by position, a positional argument or trailing block after a named one, a name for a variadic parameter, or names in a call of a function value.
LYR-SEM0120 E 08-expressions a parameter default that reads 'this' The default value of a method's parameter mentions 'this'.
LYR-SEM0121 E 05-interfaces a second member of one name on a type A type would hold two members of one name that a call could not tell apart: an extension beside the type's own member at a count it takes, two extensions of one name at one count, an extension beside a conformance's implementation or an interface default, two delegations or blanket blocks giving the name, or a static constant whose name the type already has.
LYR-SEM0122 E 05-interfaces an unqualified call of a name two conformance blocks implement A member is called by its bare name on a type that implements it separately in two conformance blocks, for two interfaces.
LYR-SEM0123 E 05-interfaces a delegated conformance whose field cannot answer it A conformance delegated with 'by field' names a field the type does not have, or a field whose type does not conform to the interface.
LYR-SEM0124 E 05-interfaces an extend block on an interface An 'extend' block names an interface as its target.
LYR-SEM0125 E 05-interfaces a qualified interface call on a receiver that does not conform A call 'Interface.member(receiver, …)' passes a first argument whose type does not conform to the interface.
LYR-SEM0126 E 05-interfaces an interface usable only as a constraint used as a value type An interface that cannot be a value type — it has a static member, a static 'let', an associated type, a generic member, or mentions 'Self' beyond the receiver — is used as the type of a value: a binding, a field, a parameter, an optional, an 'is' test.
LYR-SEM0127 E 05-interfaces a value for an interface's static 'let' A 'static let' in an interface is given a value.
LYR-SEM0128 E 05-interfaces an associated type that is not answered or not declared A conformance does not say what an interface's associated type is, or a type path or a fixation ('Iterator<Item = int>') names an associated type that the type, the interface or the bound does not declare.
LYR-SEM0129 E 05-interfaces an associated type answer that no interface asks for A type or conformance block declares 'type Name = …;' and no interface it conforms to there declares an associated type 'Name'.
LYR-SEM0131 E 05-interfaces a type test that asks nothing an interface value could answer An 'is' test or a type pattern is applied to a value that is no interface value (its type is known already), or tests against a type parameter or a type that never stands behind an interface value.
LYR-SEM0132 E 05-interfaces a conformance to a sealed interface outside its module A type, conformance block or child interface outside the module that declares a sealed interface conforms to it — for example a program's type to 'std.sync.AtomicValue'.
LYR-SEM0133 E 05-interfaces two conformances of one type to one interface A type conforms to the same interface twice in the whole program: in two blocks, in its own list and a block, or through a blanket block that reaches a type which also conforms on its own or through another block.
LYR-SEM0134 E 05-interfaces a member of a constrained block on a type that fails its constraints A member added by a generic extend block ('extend<T :: [Display]> Slice { … }') is used on an instance whose type arguments do not satisfy the block's constraints.
LYR-SEM0135 E 05-interfaces a conformance the compiler cannot synthesize, or Identity on a value An interface that is normally synthesized ('Equatable', 'Hashable', 'Default', 'Identity' …) cannot be synthesized for the type: 'Identity' on a struct or an enum, a 'Default' of an enum, a field whose type gives no such member; also a 'comptime for' over 'Variants' of an enum whose variants carry a payload.
LYR-SEM0136 E 03-types a repeated array literal of an element that would need cloning '[x] * n' repeats an element that is or holds an object (or may, in a generic body), and the element type does not conform to 'Clone'.
LYR-SEM0137 E 06-errors a type named twice in one 'throws' set A function's 'throws [ … ]' list names the same error type more than once.
LYR-SEM0138 E 06-errors a call that may throw without a 'try' mark A call (or 'await', a loop over a throwing iterator or coroutine, a close) that may throw is not marked 'try', or stands to the left of a 'try' that marks only what follows it.
LYR-SEM0139 W 06-errors a 'try' mark over nothing that can throw A 'try' mark, a 'try?' or 'try!', a 'try' block or a marked loop covers no call that can throw, or marks what an enclosing or earlier mark covers already.
LYR-SEM0140 E 06-errors 'try?' over a call without a value, used as a value 'try?' is applied to an expression of type 'void' and its result is used as a value.
LYR-SEM0141 E 06-errors an error type caught twice by one 'try' Two 'catch' clauses of one 'try' name the same error type.
LYR-SEM0142 E 06-errors a 'catch' clause no error can reach A 'catch' clause names a type every value of which is already taken by an earlier clause — typically an interface caught before one of its conformers.
LYR-SEM0143 E 06-errors 'using' on a value that is not Closeable 'using let' binds a value whose type does not conform to 'Closeable' (and is no coroutine).
LYR-SEM0144 W 06-errors a Closeable value nothing closes A value of a 'Closeable' type is made and dropped by an expression statement, or bound with a plain 'let', used, and neither closed nor handed on.
LYR-SEM0145 E 06-errors 'never' where a value of it would have to exist The type 'never' stands somewhere other than a return type — a parameter, a binding, a field, an element, an optional — or answers an associated type or a type parameter whose bound is not 'Error', or 'try?' is applied to an expression of type 'never'.
LYR-SEM0146 E 06-errors a 'return' in a function returning 'never' A function whose return type is 'never' contains a 'return', other than one returning a call that itself does not return.
LYR-SEM0147 E 07-statements 'break' or 'continue' outside a loop A 'break' or 'continue' without a label stands outside every loop of its function — including in a lambda's body inside a loop.
LYR-SEM0148 E 07-statements a 'break' with a value out of a 'while' or 'for' A 'break' carries a value, and the loop it leaves is a 'while' or a 'for', not a 'loop'.
LYR-SEM0149 E 07-statements a 'loop' whose breaks give a value only in part Some 'break's of one 'loop' carry a value and others carry none.
LYR-SEM0150 E 04-modules a visibility word on a conformance or its methods An 'extend … :: [Interface]' block carries 'pub', 'internal' or 'private', or one of its methods does.
LYR-SEM0151 E 04-modules a declaration names a type less visible than itself A declaration's signature or type names a type that is less visible than the declaration: a pub function returning an internal struct, an internal function taking a private one, a field, constant or inferred binding whose type is narrower than it.
LYR-SEM0152 W 04-modules a member is written wider than its type A field, method or constant of a struct, class or enum, or a member of an inherent extend block (or the block itself), is written with a visibility wider than the type it belongs to.
LYR-SEM0153 W 04-modules a name hides one of the prelude's A module declares or imports a name the prelude already gives every module (assert, panic, Result, Test …); the module's own wins in that module. The standard library itself is not warned.
LYR-SEM0154 E 11-metaprogramming a test takes parameters, returns a value or is private A function marked @Test takes parameters, returns something other than void, or is private.
LYR-SEM0155 E 11-metaprogramming a caller attribute sits on the wrong parameter @callerExpr, @callerLine or @callerFile is used where it cannot work: @callerExpr names no other parameter of the function, the parameter has the wrong type (string for @callerExpr and @callerFile, int for @callerLine), or it has no default.
LYR-SEM0156 E 03-types a place argument or parameter that is no place & hands a call something it may not write (a let, a temporary, a call's result), or a place parameter &p has a default or is params/variadic.
LYR-SEM0157 E 03-types an argument's place mark does not fit its parameter A place parameter's argument is written without &, a value parameter's argument with &, or a lambda's parameter mark &n does not match the function type expected where the lambda stands.
LYR-SEM0158 E 03-types a place outlives the call that handed it over A coroutine function or a generator lambda takes a place parameter, or a lambda captures a place parameter.
LYR-SEM0160 E 05-interfaces an associated type's answer does not meet its bound A conforming type (or an extend block) answers an associated type with a type that does not conform to the bound the interface declared for it, such as type Item :: [Named]; answered with int.
LYR-SEM0161 E 05-interfaces an associated type's answer carries a bound A conforming type answers an associated type with a bound of its own, as in type Item :: [Named] = Cat;.
LYR-SEM0162 W 07-statements a second loop over the same iterator A for loop walks a local or parameter that an earlier loop in the same or an enclosing block already walked, with no assignment to it between, and the binding's iterator may be shared (a class, or a type parameter a class may answer).
LYR-SEM0163 E 07-statements a loop's head takes 'try?', 'try!' or a catching form The source of a for loop is marked try?, try! or with the catching form of try instead of the plain try.
LYR-SEM0164 E 12-stdlib a format spec in an f-string hole is malformed or does not apply The spec after : in an f-string hole is not of the form [[fill]align][sign][#][0][width][grouping][.precision][type], or one of its parts does not apply to the value's type (a sign on a string, a precision on an integer …).
LYR-SEM0165 E 10-concurrency a 'throws' behind a task or coroutine return type is ambiguous A function's return type is a Task<…> or Coroutine<…> (possibly under ?) without a thrown set of its own, followed by throws without parentheses, so the clause could be the task's or the function's.
LYR-SEM0166 E 08-expressions a spread argument is not the whole rest of a variadic call A call writes xs... where it does not stand for the variadic parameter's whole array: other arguments follow it or stand beside it in the variadic part, the call spreads twice, or the callee has no variadic parameter.
LYR-SEM0167 E 04-modules an implementing member is less visible than its conformance A method or constant that implements an interface member for a type is written with a visibility narrower than the conformance, which is as visible as the narrower of the type and the interface.
LYR-SEM0168 W 05-interfaces a type's member hides a blanket member A type has a member of its own (written, inherited as an interface default, or delegated to a field) with the same name as a member a blanket extend<T :: […]> T block gives it.
LYR-SEM0169 E 04-modules a generic type's constant is not a constant expression A static let of a generic type or generic block has an initializer that would run (a call, an operation), or names itself directly or through another such constant.
LYR-SEM0170 E 05-interfaces an extend block's type parameter is bound by nothing An extend<…> block declares a type parameter that its target does not name and that no constraint of a named parameter fixes, as U in extend<T, U> Shelf<T>.
LYR-SEM0171 W 06-errors a catch-all clause that nothing reaches A catch clause without a type (catch (_)) follows clauses that already take every error type the try block throws.
LYR-SEM0172 W 10-concurrency a 'mut fn' generator on a value type changes a copy A non-static mut fn method of a struct or enum is a generator: it returns Coroutine<…> and yields.
LYR-SEM0173 W 03-types a binding or parameter holds a 'void' A local binding is initialized with a void value, or a parameter is declared with type void. Not reported for _, nor in generic code where a type parameter happens to be void.
LYR-SEM0174 E 12-stdlib a closeable iterator's close() throws more than its Error allows A type that is both an Iterator and Closeable declares a close() that throws a type its Error (the set its next() may throw) does not cover.
LYR-SEM0175 E 03-types 'opaque type' is no form of Lyric 5 A declaration is written opaque type Name = …;, the 4.x form.
LYR-SEM0176 E 07-statements a name is bound twice in one scope A let or var binds a name that the same block already binds, or a name of a parameter directly in the function body's block. _ binds nothing and is exempt.
LYR-SEM0177 E 11-metaprogramming '@AlwaysInline' and '@NoInline' on one function A function carries both @AlwaysInline and @NoInline.
LYR-SEM0178 W 11-metaprogramming the value of a '@MustUse' call is dropped An expression statement drops the non-void value of a call to a function marked @MustUse, or a value whose type is marked @MustUse (such as a Result or a task handle from std.task.spawn).
LYR-SEM0179 E 16-diagnostics a lint attribute names no lint The argument of @Allow, @Warn or @Deny is no lint's name or code, no group, and not warnings.
LYR-SEM0180 W 16-diagnostics an '@Allow' that takes back nothing An @Allow names a lint that nothing inside the declaration or module it sits on reports.
LYR-SEM0181 E 03-types an inline function keeps a function parameter Inside an inline fn, a parameter of function type is used other than by calling it or passing it to another inline fn: returned, stored, captured or passed to an ordinary function.
LYR-SEM0182 E 03-types an inline function reaches itself An inline fn calls itself, directly or through other inline fns; reported at the call that closes the cycle.
LYR-SEM0183 E 03-types an inline function used as a value An inline fn is named anywhere other than as the callee of a call: bound to a variable, passed as an argument, returned.
LYR-SEM0184 E 03-types a function that cannot be inline inline is written on a function whose body cannot be set in place: an interface member, a function without a body (extern), a mut fn, a function with a place parameter, or a body that yields.
LYR-SEM0185 E 11-metaprogramming a reflection access outside a round of its own e.[f], E.[v], e.[m](…), e is v or an attribute query (fieldAttribute, variantAttribute, memberAttribute, parameterAttribute) uses a variable that is not the variable of a comptime for over a known type's fields, variants or members, or applies it to a value of another type, or uses E.[v] for a variant with a payload.
LYR-SEM0186 E 11-metaprogramming a macro's signature is not syntax to syntax A macro declares a parameter or a result whose type is not a std.syntax type, declares type parameters, or, as an attribute macro (first parameter a declaration), returns something other than Decl or Decl[].
LYR-SEM0187 E 11-metaprogramming a macro called as a function A macro's name is called like a function, name(…), instead of being expanded with name!(…).
LYR-SEM0188 E 11-metaprogramming a macro's result does not fit its site A macro that gives statements back (Stmt, Stmt[], Block) stands where an expression is needed, or a macro gives back a kind (an Ident, a Type, a declaration) that no expression or statement site takes.
LYR-SEM0189 E 11-metaprogramming a macro expanded in its own module A site name!(…) or @name stands in the module that declares the macro.
LYR-SEM0190 E 11-metaprogramming a macro site names no macro A site name!(…) names nothing in scope, or names something that is not a macro (a function, a type).
LYR-SEM0191 E 11-metaprogramming a macro site's arguments do not fit the macro A macro site writes more or fewer arguments than the macro takes, an argument is not the kind of syntax its parameter takes, a trailing block meets no Block or Stmt[] parameter, or an attribute macro sits on a declaration of another kind than its first parameter, takes nothing, or is written with fields.
LYR-SEM0193 E 11-metaprogramming a splice outside a quote or of the wrong kind A splice #{…} stands outside a quote, or splices a kind of syntax its position in the quote does not take, such as Stmt[] where an expression stands.
LYR-SEM0194 E 11-metaprogramming a quote in a program that does not reach std.syntax A quote { … } stands in a program that does not import std.syntax.
LYR-SEM0195 E 12-stdlib a part of the standard library the lowering needs is missing The lowering translates a construct through the standard library (for through std.iter, string + and f-strings through std.string, panic through std.core) and does not find that part on the module path.
LYR-SEM0196 E 05-interfaces a delegation the lowering cannot express yet (retired) A type delegates an interface to a field whose type is another interface ([A by inner] with inner: B), or a generic member of an interface is reached on a type that forwards it to a field. Retired: A field of a child interface forwards through the parent's table, and a generic member is forwarded per use, on the field's own member; nothing refuses either.
LYR-SEM0197 E 03-types the monomorphization does not terminate The set of generic instances a program asks for is not finite: each instance asks for a further one — a function that calls itself with a type built from its own (grow(W<T> { v = x })), a method whose result type is built from its own element type (Wrap<T>.deeper(): Wrap<Wrap<T>> called on its own result). Refused at a chain 128 deep, or past 20 000 instances.
LYR-SEM0198 W 07-statements a parameter that is never used A function's parameter is never named in its body. A method of a type with a conformance list, and a parameter whose name begins with _, are not reported.
LYR-SEM0199 W 07-statements a 'var' that is written and never read Every use of a var is the target of an assignment: what it stores is never read.
LYR-SEM0200 W 03-types a type parameter that is never used A function's type parameter is named nowhere in it — not in a parameter, the result or the body. A type's is not reported: a phantom parameter only the type's name uses is a type's own.
LYR-SEM0201 W 04-modules a declaration nothing uses A declaration of a module that is not pub and carries no attribute is named nowhere in the compilation. main is not reported.
LYR-SEM0202 W 08-expressions an assignment written as a condition The condition of an if, a while or a do … while is an assignment, where a comparison with == is usually meant.
LYR-SEM0203 W 08-expressions an assignment of a value to itself An = whose value is its own target — x = x, a.b = a.b — or x = x++, which keeps the old value.
LYR-SEM0204 W 08-expressions a comparison of an unsigned value with 0 that cannot fail An unsigned value compared with the literal 0 in a way that is always true (n >= 0) or always false (n < 0).
LYR-SEM0205 W 08-expressions an equality test on floats == or != with a float or float32 on both sides. Not said unless the lint is set to warn.
LYR-SEM0206 W 07-statements a local that hides one of the same name A local binding in an inner block takes the name of a local or a parameter around it. Not said unless the lint is set to warn.
LYR-SEM0207 W 04-modules a local that hides a module the file imports A local or a parameter takes the name a whole-module import binds — import std.io; binds io. Not said unless the lint is set to warn.
LYR-SEM0208 W 03-types an integer literal that takes another type than int An integer literal without a suffix takes a type other than int from its context. Not said unless the lint is set to warn.
LYR-SEM0209 W 08-expressions a block's implicit 'it' that hides the 'it' around it A trailing block that uses its implicit it stands inside another trailing block with an implicit it.
LYR-SEM0210 W 14-cli an exit code outside 0 to 255 fn main(): int returns an integer literal below 0 or above 255; the process leaves with it modulo 256.
LYR-SEM0211 W 05-interfaces a conformance of another package's type to another package's interface A conformance block is written for a type of another package to an interface of another package (std among them).
LYR-SEM0212 W 10-concurrency a task's handle dropped An expression statement starts a task with spawn or Thread.spawn and drops the Task it gives; a scope's spawn is left alone, the scope awaits it.
LYR-SEM0213 W 10-concurrency a module 'var' in a program that starts threads A module of a program that imports std.thread declares a module-level var.
LYR-SEM0214 W 16-diagnostics a construct an edition retires The name for the warning on a construct a newer edition retires. There is no edition yet, so nothing says it.
LYR-SEM0215 W 16-diagnostics a name against the naming convention A type, a type parameter or a variant not in PascalCase; a function, a field, a parameter, a local or a constant not in camelCase; a module with capitals in its name.
LYR-SEM0216 W 04-modules a module named as a Windows device A module is named con, prn, aux, nul, com0 to com9 or lpt0 to lpt9, in any case.
LYR-SEM0217 W 08-expressions 'clone()' of a value a copy makes whole clone() is called on a number, a bool, a char, a string, or a struct or an enum made of only such.
LYR-SEM0218 W 07-statements a 'return;' that ends a body The last statement of a function's or a lambda's body is return;. Not said unless the lint is set to warn.
LYR-SEM0219 W 07-statements 'while (true)' where 'loop' is meant A while loop's condition is the literal true. Not said unless the lint is set to warn.
LYR-SEM0220 W 08-expressions a string grown with '+' in a loop In a loop, a string kept across its rounds is assigned itself with something added: s = s + x or s += x.
LYR-SEM0221 W 03-types a large struct passed by value A parameter's type is a struct of more than 64 bytes, counted without padding. Not said unless the lint is set to warn.
LYR-SEM0222 W 05-interfaces a value boxed as an interface in a loop In a loop, a number or a struct or enum value is passed where the parameter's type is an interface. Not said unless the lint is set to warn.
LYR-SEM0223 W 01-lexical a pub declaration without documentation A pub function, type, field, method or module binding has no /// above it; a method a conformance answers is documented by its interface. Not said unless the lint is set to warn.
LYR-SEM0224 W 01-lexical a doc link that names nothing A /// links [Name] or [Type.member], and nothing of that name is visible where the documented declaration stands.
LYR-SEM0225 W 01-lexical a module without module documentation A module that declares something pub does not begin with //! lines. Not said unless the lint is set to warn.
LYR-SEM0226 E 07-statements a 'return' without the value the function returns A bare return; stands in a function, a lambda or a coroutine whose result is not void.
LYR-SEM0227 E 01-lexical an integer literal too large for 'int' An integer literal without a suffix whose type is int is greater than int.max.
LYR-SEM0228 E 03-types an inline array of another length An array literal or a repetition [x] * n that is to be an inline array T[N] makes another number of elements than N.
LYR-SEM0229 E 03-types a place of another type than the place parameter A place argument &x is of another type than the place parameter &p: T it is passed to; nothing widens into a place.
LYR-SEM0230 E 05-interfaces an interface value made through a shape's or a blanket block (retired) A value is made into an interface it conforms to only through a block on a shape or a blanket conformance: such a value is not built in this release. Retired: A value of an interface is made through a shape's block or a blanket conformance — the shape in a box, a named type with the block's row in its table; nothing refuses it.
LYR-SEM0231 E 05-interfaces a static member of an interface called through the interface A static member of an interface is called on the interface's name, Make.make<Item>(s): the interface has no value to call it for.
LYR-SEM0232 E 07-statements a loop over a string A for loop walks a string, which is no Iterable: s.chars() gives its characters, s.lines() its lines.
LYR-SEM0233 E 13-abi a memory operation outside an unsafe block A pointer's read, write, offset or cast, std.ffi's alloc or free, or GcHandle.from, is called outside an unsafe { … } block.
LYR-SEM0234 W 13-abi an unsafe block that holds no memory operation An unsafe { … } block calls none of std.ffi's memory operations, or stands within another unsafe block, which covers what it holds already.
LYR-SEM0235 E 04-modules a member two seen modules add A call names a member that two modules this one sees add to the type, each in an extend block, at a count both take.
LYR-SEM0236 E 07-statements a jump out of a 'defer' body A return stands in a defer body, or a break or continue goes to a loop around the defer.

A.5 MAC — Macros

A macro's own refusal, at its site.

Code S Chapter Title When
LYR-MAC0001 E 11-metaprogramming an error a macro reports A macro called error(at, message) of std.syntax while it expanded: the macro refuses its arguments. The diagnostic stands at the node the macro named, with a note at the site's !.

A.6 MIG — The migration

lyric fix --from-4: a Lyric 4 program it does not read, and what it leaves to a person.

Code S Chapter Title When
LYR-MIG0001 E 14-cli a program Lyric 4.6 refuses is not migrated lyric fix --from-4 reads the program with Lyric 4.6's own front end, and 4.6 refuses it. Nothing is written; 4.6's findings are said before this error. The exit code is 1.
LYR-MIG0002 E 14-cli a lyric.json the migration cannot read lyric fix --from-4 finds a lyric.json that Lyric 4.6 would not have read either: not JSON, a key of the wrong kind, a path that is not there. The exit code is 2.
LYR-MIG0101 H 14-cli a module named otherwise by its header A note of lyric fix --from-4: a Lyric 4 module's module header gave it a name other than its path does. The header goes; Lyric 5 names the module by its path, and the package's own imports of it are rewritten to that name.
LYR-MIG0102 H 14-cli a native root without a counterpart A note of lyric fix --from-4: the lyric.json names a native root (nativeRoots), whose modules Lyric 4 took from a host. Lyric 5 has no host and no native roots; a library of C is described under [native] and called through extern "C".
LYR-MIG0103 H 14-cli a source root other than src/ A note of lyric fix --from-4: the Lyric 4 project keeps its modules somewhere other than src/ — its own directory, or the sourceRoot it names. A Lyric 5 package keeps them under src/; the migration does not move files.
LYR-MIG0104 H 14-cli a toolchain line of Lyric 4 A note of lyric fix --from-4: the lyric.json names a version of Lyric 4 under toolchain. It goes; [package] toolchain in lyric.toml names the least Lyric 5 a package needs, where one is needed.
LYR-MIG0106 H 14-cli declarations the whole package now sees A note of lyric fix --from-4, once a module: declarations without pub were private to their module in Lyric 4 and are seen by the whole package in Lyric 5. main is left aside.
LYR-MIG0107 H 14-cli a build script of Lyric 4 A note of lyric fix --from-4: the project has a build.lyr written for Lyric 4, which defined the build. In Lyric 5 lyric.toml does — [[bin]], [profile.*] —, and a build script only prepares sources.
LYR-MIG0108 H 14-cli tests compiled apart A note of lyric fix --from-4: the lyric.json names a testRoot, whose files Lyric 4 compiled apart from the program. Lyric 5 runs a package's tests/ with lyric test; each test is an @Test function.
LYR-MIG0110 H 14-cli a file without an entry A note of lyric fix --from-4: a single file has no main. Lyric 4 ran it as a library of a host; Lyric 5 asks a single file for its entry.
LYR-MIG0205 H 14-cli an opaque type became a struct A note of lyric fix --from-4: an opaque type H = T; of Lyric 4 is written as struct H :: [Equatable] { v: T }, x as H as H { v = x } and h as T as h.v.
LYR-MIG0208 H 14-cli a format spec without its old output A note of lyric fix --from-4: a format spec of Lyric 4 (.NET's) that Lyric 5's format language writes otherwise for some values (D, X on a signed integer), or not at all (E, P, C, G, R, a custom format).
LYR-MIG0211 H 14-cli a generic interface named by an associated type A note of lyric fix --from-4: Indexable<T> is IndexSet<int> with type Output = T, and Iterable<T> or Indexable<T> as the type of a value has no counterpart in Lyric 5.
LYR-MIG0301 H 14-cli a written field became 'var' A note of lyric fix --from-4: a field of the program's own type is written, so the migration declares it var.
LYR-MIG0302 H 14-cli an equality or order with another type A note of lyric fix --from-4: Equatable<U>, Ordered<U> or Hashable<U> names a type other than its own, which Lyric 5's interfaces cannot say.
LYR-MIG0303 H 14-cli two operator results in one declaration A note of lyric fix --from-4: one declaration conforms to operator interfaces with two different results, and Lyric 5 names one type Out a declaration.
LYR-MIG0304 H 14-cli a compare that returned an int A note of lyric fix --from-4: compare returned an int in Lyric 4 and returns ?Ordering in Lyric 5; the migration rewrites the method and the calls compared with 0, and says the others.
LYR-MIG0305 H 14-cli a hash that returned an int A note of lyric fix --from-4: hash() returned an int in Lyric 4; Lyric 5's hash writes the value into a hasher, and the migration rewrites the method.
LYR-MIG0309 H 14-cli arithmetic that may have meant to wrap A note of lyric fix --from-4: a function computes with an integer constant beyond 32 bits — a hash, a generator —, whose overflow wrapped in Lyric 4 and panics in Lyric 5.
LYR-MIG0311 H 14-cli a library function used as a value A note of lyric fix --from-4: a function of Lyric 4's library that is a method in Lyric 5, sum or over, is used as a value, and no function stands for it.
LYR-MIG0312 H 14-cli a string's length in characters A note of lyric fix --from-4: a string's length() counted characters in Lyric 4 and counts bytes in Lyric 5; the migration writes charCount().
LYR-MIG0313 H 14-cli an argument written twice A note of lyric fix --from-4: s.substring(start, count) is written with an end, start + count, and a start that calls something now runs twice.
LYR-MIG0315 H 14-cli an index that changed twice A note of lyric fix --from-4: s.indexOf(n) gave a character's index or -1; find gives a byte's index or null.
LYR-MIG0318 H 14-cli an array as a key A note of lyric fix --from-4: an array is the key of a Map or the element of a Set, which Lyric 4's checker passed and Lyric 5 refuses.
LYR-MIG0320 H 14-cli a method that writes under an interface A note of lyric fix --from-4: a method of a class writes the object's state, and the interface it answers declares it without mut.
LYR-MIG0321 H 14-cli a written parameter A note of lyric fix --from-4: a function writes a struct it took as a parameter. It was a copy in Lyric 4; in Lyric 5 a parameter is a let.
LYR-MIG0322 H 14-cli an enum that holds itself A note of lyric fix --from-4: an enum holds itself, directly or through a struct. Lyric 4 kept payloads by reference; an enum of Lyric 5 is a value and would have no size.
LYR-MIG0402 H 14-cli an operation that answered whether it worked A note of lyric fix --from-4: a silent operation of Lyric 4 answered false when it failed, file.remove(p); in Lyric 5 it throws and answers nothing, and its answer is used here.
LYR-MIG0408 H 14-cli a try around all of main A note of lyric fix --from-4: a try holds all of main, which could not throw in Lyric 4; in Lyric 5 main may.
LYR-MIG0409 H 14-cli a close that a using says A note of lyric fix --from-4: defer stream.close(f) closes by hand what a using binding closes in Lyric 5.
LYR-MIG0501 H 14-cli a task without a form A note of lyric fix --from-4: a use of Lyric 4's std.task that the migration cannot write: a wait for a descriptor or an interrupt, a spawn apart from its run(), a coroutine held in a value, interrupt(), pending(), or the module named by an alias.
LYR-MIG0502 H 14-cli tasks became a scope A note of lyric fix --from-4: the spawns of a block and its run() are a TaskScope, whose close() waits for the tasks as run() did.
LYR-MIG0601 H 14-cli a library function without a form A note of lyric fix --from-4: a function of Lyric 4's library has no form in Lyric 5, by decision: an optional has no functions, a Result has of and get.
LYR-MIG0602 H 14-cli a library function that behaves otherwise A note of lyric fix --from-4: a function of Lyric 4's library has a form in Lyric 5 that compiles and behaves otherwise somewhere.
LYR-MIG0616 H 14-cli a function bound to .NET A note of lyric fix --from-4: an extern "dotnet" binds a function of .NET, which Lyric 5 runs without.

A.7 CT — Compile-time evaluation

The evaluation of comptime, a macro or a synthesis at build time.

Code S Chapter Title When
LYR-CT0001 E 11-metaprogramming a panic while evaluating at compile time Code run at compile time — a comptime site, an attribute's value, a macro — panics. The message names the panic and the run-time code (LYR-RT…) the built program would have ended with; the notes show where the evaluation went.
LYR-CT0002 E 11-metaprogramming a compile-time evaluation over its budget A comptime site, or a macro's expansion, runs more interpreter steps than its budget: 50 000 000 by default, or what comptimeBudget under [package] in the root lyric.toml sets.
LYR-CT0003 E 11-metaprogramming compile-time code that reaches outside the program Code run at compile time calls a native function that reaches the world: the console, files, the clock, the network, processes, the environment.
LYR-CT0004 E 11-metaprogramming an embed that cannot read its file A call to std.core.embed would run in the built program instead of at compile time, or names a file that does not exist or lies outside the package's directory.
LYR-CT0005 E 11-metaprogramming a form that does not run at compile time yet Code run at compile time reaches something the compile-time interpreter does not run: a coroutine (a generator, sequence { }, a task), a native function without a compile-time implementation, a float parsed from text, or a syntax form std.syntax has no form for.
LYR-CT0006 E 11-metaprogramming a use of a declaration the build leaves out Code that is built for this target uses a declaration whose @When condition is false for it, so the declaration is not built.
LYR-CT0007 E 11-metaprogramming a macro expansion that does not end The expansion of macro sites does not finish: after 32 rounds a macro's result still holds a site, or every macro still to be expanded waits for a module whose own sites wait for it.

A.8 CG — Code generation

What the C backend does not take.

Code S Chapter Title When
LYR-CG0001 E 16-diagnostics a construct the C backend does not translate The backend's subset gate meets something in the IR it has no translation for: a native function of the standard library without a runtime call, a host type, an IR instruction or type the emitter does not know. The message names the construct, and says where it is a compiler bug.
LYR-CG0002 E 12-stdlib a compile-time-only function called at run time The program would call, at run time, a function of std.syntax that reads, builds or writes a syntax tree. Reported at every such call the built program reaches, the standard library's own among them.

A.9 PKG — Packages and manifests

lyric.toml, the lock file, dependencies.

Code S Chapter Title When
LYR-PKG0001 E 15-project lyric.toml or lyric.lock is not valid TOML Reported when the manifest lyric.toml, or the lock lyric.lock, of any package of the graph does not parse as TOML. The error points at the line and column where reading failed.
LYR-PKG0002 E 15-project a manifest or lock field that is missing or malformed Reported when lyric.toml or lyric.lock parses as TOML but a field is missing, has the wrong type, or has a value of the wrong form: a package name or version, an edition, a dependency, a [[bin]] entry, a profile, [native], [trust], [lints], a toolchain pin, a locked revision, a source tree of [native.vendor] or an @name/ path that names none, a bindings entry — and a prebuilt file [native] names that is not part of the package or not there, or a URL's tree without its hash, when the build needs it.
LYR-PKG0003 E 15-project a key or section the manifest does not have Reported for a key or section of lyric.toml the toolchain does not know — in [package], a dependency, [[bin]], a profile, [native], [trust], [lints], or at the top — and for forms 5.0 does not have: a dependency as a bare version (a registry's form), an [override] from git.
LYR-PKG0004 E 15-project a dependency's source holds no package of that name Reported when the directory or repository a dependency names has no lyric.toml, when the package found there has another name, or when a package read from git names a dependency by a directory. The error points at the line of the declaring manifest.
LYR-PKG0005 E 15-project one package name read from two sources Reported when the graph asks for a package of one name from two sources — two directories, two repositories, two revisions, or two versions of different lines — and the root's [override] does not pick one.
LYR-PKG0006 E 15-project a repository has no such revision or no package at it Reported when a git dependency's repository does not have the tag, branch or commit it names, has no lyric.toml at its root at that revision, or holds the package under a tag that is a version at another version than its manifest gives.
LYR-PKG0007 E 15-project a git dependency or a source tree cannot be read Reported when the repository of a dependency or of a source tree cannot be cloned or fetched, when a source tree's URL cannot be loaded, when git is not on the PATH, or when under --offline the user's cache does not hold the revision or the file. The exit code is 2: the environment failed, not the manifest.
LYR-PKG0008 E 15-project the lock or a hash disagrees with what was read Reported when lyric.lock holds a commit the repository of a dependency or a source tree does not have, when the content at the locked commit is not what the lock's hash says, or when the file a source tree's URL loads is not the one its hash names.
LYR-PKG0009 E 15-project a package asks for a newer toolchain Reported when a package of the graph has toolchain = "X.Y" (or ">=X.Y") in [package] and the running toolchain is older. The exit code is 2.
LYR-PKG0010 E 15-project packages that depend on each other in a cycle Reported when a package of the graph depends on itself, directly or through others. The message gives the cycle's path, app -> geo -> app, and points at the dependency that closes it.
LYR-PKG0011 E 15-project --locked and a lock that does not match Reported under --locked when lyric.lock lacks a revision the graph reads from git or a source tree from git the build needs, holds one it does not read, or is missing although the program reads from git. Nothing is fetched or written.
LYR-PKG0012 E 15-project a dependency's build script the root does not trust Reported when a dependency has a build.lyr and the root manifest's [trust] build-scripts does not name it. The build stops before any script runs, at the line that declares the dependency.

A.10 BLD — The build

The C toolchain, the runtime, the build script.

Code S Chapter Title When
LYR-BLD0001 E 14-cli the C compiler or the linker failed Reported by build, run, test and bench when compiling the generated C, a package's native C or a build script's C, archiving the runtime, or linking the binary fails, or does not finish within five minutes and is stopped. The message carries the command and what the C compiler wrote, or the limit; the exit code is 2. A link whose failure the build can read is said as its findings instead (LYR-LNK0001–LYR-LNK0003); this error stands for what is left. A header no directory holds adds the directories that were searched.
LYR-BLD0002 E 15-project a package's build script did not build or did not succeed Reported when a package's build.lyr does not compile, ends with an exit code other than 0, or does not end within 10 minutes. The package is not built; for a script that ran, what it wrote follows the message.
LYR-BLD0003 W 15-project a warning a build script reported Reported when a package's build.lyr calls std.build.warn: the build shows the script's message as a warning, prefixed with the package's name.
LYR-BLD0004 E 15-project a library of the machine cannot be had for this build Reported when a package's native part, or its build script, names a library of the system through pkgConfig and pkg-config is not there, does not know the name, or the build is for another target than the host — or names a macOS framework for a build for macOS on a host that is not macOS. Nothing is built; the exit code is 2: the machine lacks what the package asks of it.
LYR-BLD0005 E 15-project a module cannot be made from a C header Reported when a header a package's bindings names does not compile — with what the C compiler said — or when the C compiler writes no syntax tree of it, which only zig cc and clang do. Nothing is built; the exit code is 1.
LYR-BLD0006 E 15-project a file the build puts beside the binary is not there, shares its name, or would not be found there Reported when a package's build.lyr names a file with std.build.besideBinary that is not there when the script has ended, when two such files — or dylibs of the native part — have one name, or when a library of dylibs would not be found there — a Mach-O library whose install name does not begin with @rpath/, an ELF library without a soname. Nothing is built; the exit code is 1.

What the linker says, read: a symbol nothing defines, a library it does not find, a symbol defined twice (15 §5.2 rule 12).

Code S Chapter Title When
LYR-LNK0001 E 15-project a C symbol nothing the link takes defines Reported by build, run, test and bench when the linker finds no definition of a symbol the program or a package's C calls. The finding stands at the extern declaration that names the symbol, where the program declares it; else it says what references it. Nothing is linked; the exit code is 2.
LYR-LNK0002 E 15-project a library the linker does not find Reported by build, run, test and bench when the linker finds no library by a name a package's [native] part, its build script or pkg-config gave it, or no macOS framework by its name. The finding stands at the line of the manifest that names it, or says who named it. Nothing is linked; the exit code is 2.
LYR-LNK0003 E 15-project a C symbol two inputs of the link define Reported by build, run, test and bench when the linker finds a symbol defined twice — by two packages' C, a package and the program, or one package twice. The finding names who defines it and where. Nothing is linked; the exit code is 2.

A.12 CLI — The command line

The driver's options and verbs.

Code S Chapter Title When
LYR-CLI0001 E 14-cli a directory or file named on the command line does not exist Reported when the directory given with -C, or the file given to build, run or expand, does not exist. The path is printed as resolved; the exit code is 2.
LYR-CLI0002 E 14-cli no C compiler was found Reported by build, run, test and bench when no C compiler is found — LYRIC_CC, then the zig lyric toolchain install zig installed, then zig, clang, gcc on the PATH — or when the profile needs clang (asan, tsan) and there is none. The exit code is 2.
LYR-CLI0003 E 14-cli a command line the toolchain does not accept Reported for an unknown verb, option or value, an option without its value, a profile or target that does not exist, a --bin the package does not have, a name remove or update does not find, and for run of a binary built for another machine. The exit code is 2.
LYR-CLI0004 E 14-cli no package here or above Reported by every verb about a package — build and run without a file, expand, test, bench, update, clean, metadata, add, remove — when there is no lyric.toml in the directory or any directory above it. The exit code is 2.
LYR-CLI0005 E 14-cli a library has no program to run or print Reported by run, expand and build --emit for a package without src/main.lyr and without [[bin]] programs: a library. build checks such a package instead. The exit code is 2.
LYR-CLI0006 E 14-cli the external runtime could not be started (retired) Reported by the 4.x drivers when the bytecode VM or another tool they started as a separate process could not be launched. Retired: Lyric 5: lyric5 builds native binaries and starts no VM
LYR-CLI0007 E 15-project several programs and none named Reported by run, expand and build --emit for a package with several programs — [[bin]] entries — and no src/main.lyr, when --bin does not name one. The message lists the programs; the exit code is 2.
LYR-CLI0008 E 14-cli a dependency add or remove cannot edit Reported by add, remove and update when the dependency to change is written in lyric.toml as a table of its own rather than on one line. The manifest is left as it was; the exit code is 2.
LYR-CLI0009 E 14-cli the function named by --function is not in the module (retired) Reported by the 4.x compiler's dump commands when --function named a function the module does not have. Retired: Lyric 5: lyric5 has no --function option; the constant has no use outside its declaration
LYR-CLI0010 E 14-cli a lyric.json that cannot be understood (retired) Reported by the 4.x toolchain when a lyric.json project file was found and could not be read. Retired: Lyric 5: the manifest is lyric.toml, refused with LYR-PKG0001–0003
LYR-CLI0011 E 14-cli no build.lyr in the directory a build was pointed at (retired) Reported by the 4.x lyrbuild when the directory it was given held no build script. Retired: Lyric 5: a package is built from its lyric.toml, and a build.lyr is optional; the constant has no use outside its declaration
LYR-CLI0012 E 14-cli the build script ran and did not finish its job (retired) Reported by the 4.x lyrbuild when the build script panicked, had no build function, or declared nothing to compile. Retired: Lyric 5: a failing build.lyr is LYR-BLD0002; the constant has no use outside its declaration
LYR-CLI0013 E 14-cli the stub was started without a program (retired) Reported by the 4.x packed-executable stub when it was started directly and carried no program. Retired: Lyric 5: binaries are native and there is no stub; the constant has no use outside its declaration
LYR-CLI0014 E 14-cli a packed executable is damaged (retired) Reported by the 4.x stub when the footer of a packed executable did not hold together, as after a truncated download. Retired: Lyric 5: binaries are native and there are no packs; the constant has no use outside its declaration
LYR-CLI0015 E 14-cli no stub to pack into (retired) Reported by the 4.x lyrpack when no stub executable was found through --stub, LYRIC_STUB or beside the binary. Retired: Lyric 5: binaries are native and there is no stub; the constant has no use outside its declaration
LYR-CLI0016 E 15-project warnings under a profile that denies them (retired) Reported after a compilation that warned when the profile had denyWarnings: one error that counted the warnings, which stayed warnings. Retired: A profile that denies warnings is -D warnings — each warning is the error, with a note naming the profile.
LYR-CLI0017 W 14-cli a lyric.json holds something suspect (retired) Reported by the 4.x toolchain for a lyric.json that loaded but held something suspect, such as an unknown key. Retired: Lyric 5: the manifest is lyric.toml, where an unknown key is the error LYR-PKG0003; the constant has no use outside its declaration
LYR-CLI0018 E 14-cli a lyric.json asks for a newer toolchain (retired) Reported by the 4.x toolchain when a lyric.json named a minimum toolchain version above its own. Retired: Lyric 5: a toolchain pin in lyric.toml is LYR-PKG0009
LYR-CLI0019 E 14-cli --only named an artifact the build script did not declare (retired) Reported by the 4.x lyrbuild when --only <name> named no artifact of the build script. Retired: Lyric 5: lyric5 has no --only option; programs are chosen with --bin (LYR-CLI0003 for an unknown one); the constant has no use outside its declaration
LYR-CLI0020 E 14-cli an internal failure of the 4.x compiler (retired) Reported by the 4.x drivers when the compiler reached a state it believed impossible. Retired: Lyric 5: lyric5 reports its own failures as LYR-ICE0001 (exit 101); nothing in lyric5 calls CliDiagnostics.FailInternal
LYR-CLI0021 E 14-cli no package can be made here lyric new names a directory that exists already, lyric init runs where a lyric.toml is, or the git init the command asked for failed. The exit code is 2.
LYR-CLI0022 E 14-cli the revision lyric api --diff names cannot be read lyric api --diff <rev> runs in no git repository, names a revision git does not know, or the revision holds no lyric.toml where the package is. The exit code is 2.
LYR-CLI0023 E 14-cli a toolchain cannot be fetched lyric toolchain reaches neither the mirror nor GitHub, or the channel has no such version or no archive for this machine. The exit code is 2.
LYR-CLI0024 E 14-cli a toolchain fetched is not what its index says No source serves a channel's index with a signature one of the toolchain's keys made and no older than this machine has seen, or an archive at the size and SHA-256 its index gives, or the archive's toolchain.json differs from what it holds. Nothing is installed; the exit code is 2.
LYR-CLI0025 E 14-cli the installed toolchains refuse the change lyric toolchain default or remove, or LYRIC_TOOLCHAIN, names a version that is not installed, remove names the default or the toolchain that runs the command, update finds no default, an installed toolchain a command is handed to cannot be run, or config.toml under LYRIC_HOME is not one the toolchain reads. The exit code is 2.

A.13 IR — The lowering

Retired: each refusal of the lowering has a code of its own.

Code S Chapter Title When
LYR-IR0001 E 16-diagnostics a construct this compiler version could not lower (retired) The lowering's one code for every refusal in earlier versions: what the language does not express yet, what the standard library lacked, and its own bugs, all under one number. Retired: Each refusal of the lowering says its reason under a code of its own — LYR-SEM0195, LYR-SEM0196, LYR-SEM0197, or LYR-ICE0002 for a construct the checker accepted and the lowering cannot translate.

A.14 ICE — Internal compiler errors

The toolchain's own failure: a bug to report, never the program's fault.

Code S Chapter Title When
LYR-ICE0001 E 16-diagnostics the toolchain crashed lyric5 met an exception it did not expect. It prints the exception, where it was in the program if it knows, and its own stack trace, writes the same with the version, the command and the machine to a report under out/ (lyric5-ice-<time>-<pid>.txt), and exits with 101.
LYR-ICE0002 E 16-diagnostics a construct the lowering cannot translate The checker accepted a construct that the lowering to IR cannot translate. The diagnostic carries the note that it is the compiler's fault.

A.15 RT — Runtime panics

A panic ends the program with exit code 101 and a backtrace; the compile-time evaluation reports the same codes inside LYR-CT0001.

Code S Chapter Title When
LYR-RT0001 P 03-types integer division by zero An integer / or % has a zero divisor. Integer division checks its divisor in every profile; check it before dividing where zero can occur.
LYR-RT0002 P 03-types integer overflow An integer operation's result does not fit its type: +, -, *, unary -, MIN / -1 and MIN % -1, or a shift by a count outside 0 to the width minus one. Arithmetic is checked in every built-in profile; the library's wrapping operations are there where wrapping is meant.
LYR-RT0003 P 03-types an index or a range out of bounds An index is negative or not below the length, a view's range does not satisfy 0 <= low <= high <= length, or a string's byte index or range does not fall on a character's boundary. Copying into a shorter view panics the same way.
LYR-RT0004 P 03-types a null value unwrapped x! met a ?T that holds nothing. Use ?., ?? or a match where the value can be absent.
LYR-RT0005 P 13-abi out of memory An allocation does not fit: the heap has no room left (or exceeds the limit the embedding host set), or an array or string length is so large that its size does not fit the address space.
LYR-RT0006 P 13-abi stack overflow A task's or the main thread's stack is exhausted, typically by recursion without an end. The panic ends the task it happens in, like any other, with the frames that led there.
LYR-RT0007 P 03-types an argument that breaks a precondition A length or count from the program text is negative: the count of [x] * n, the count of a string's repetition, the length of a new array or string. The standard library's own precondition checks (a negative capacity, a radix outside 2 to 36, a bad format string) panic with LYR-RT0008 instead.
LYR-RT0008 P 06-errors panic called by the program The program called panic(message), or a function of the standard library did on a broken precondition (a negative capacity, a radix outside 2 to 36, a format string with a brace left open). The message is printed as written, with the backtrace; the process exits with 101, or a task ends with the panic as its status.
LYR-RT0009 P 03-types a conversion to char of no Unicode scalar value An integer converted with as char is a surrogate (0xD800 to 0xDFFF) or beyond 0x10FFFF. Check the value before converting it.
LYR-RT0010 P 06-errors try! on an error try! f() met an error. The panic carries the error's message; use try and let the error propagate, or catch it, where it can happen.
LYR-RT0011 P 06-errors a failed assertion assert(condition) found its condition false. The message names the condition as written and, when the assertion has one, the message its lambda builds on failure.
LYR-RT0012 P 06-errors unreachable reached Control reached unreachable() or unreachable(message) — a place the program's author held unreachable. The message starts with the word unreachable, followed by the program's own message.
LYR-RT0013 P 06-errors todo reached Control reached todo() or todo(message): code that is not written yet. The message starts with not implemented, followed by the program's own message.
LYR-RT0014 P 10-concurrency a coroutine misused A coroutine is used against its rules: a yield where no coroutine runs, or in a task outside every generator; a coroutine resumed while it runs, after it ended, or on another thread; a coroutine closed while it runs or is parked, or with C frames on its stack — a callback that yielded in it; a yield of another type than the running generator's.
LYR-RT0015 P 13-abi the system refused the runtime what it needs The operating system refused the runtime something it cannot go on without: a poller for I/O and timers, its wakeup, a pipe for signals or child processes, random bytes, a thread's attachment to the collector. No program text causes it; the machine's limits or state do (too many open descriptors, for example).
LYR-RT0016 P 12-stdlib a collection changed while it was walked A collection of std.collections was changed while a for loop or an iterator walked it. The next step of the walk panics, naming the collection's kind; collect the changes and apply them after the loop.
LYR-RT0017 P 06-errors control reached code the compiler holds unreachable Control arrived where the compiler knows it cannot arrive — behind a call that does not return, behind a match that covers every case. That is a bug in the compiler: the debug profile panics with this code; the release profile stops with the processor's trap, which the runtime reports as a crash. Report it with the program.
LYR-RT0018 P 10-concurrency a deadlock Every task of a thread waits — for a channel, a lock, another task — and nothing can wake one: no task is ready, none sleeps, no other thread lives. The wait panics in the waiting task.
LYR-RT0019 P 10-concurrency a lock poisoned by a panic A task acquires a Mutex, RwLock or Once whose holder panicked while it held it. The scheduler released the lock and poisoned it; the panic names the first panic's code and message.
LYR-RT0020 P 16-diagnostics the runtime found its own invariant broken The runtime met a state its own rules exclude — a thread allocating that the collector does not know, an object whose descriptor gives no size, a pointer the collector's map of a type does not name, a young object stored without its barrier, a coroutine whose descriptor is no coroutine's. That is a bug in the runtime or in the compiler, never in the program.
LYR-RT0021 P 13-abi an integer from C that no variant of the enum stands for A C function declared to return a @Layout enum returned an integer that is none of the enum's variants. A C enum may hold any integer of its type; a Lyric enum holds one of its variants, the first as 0, the next as 1, in the order they are written.
LYR-RT0022 P 13-abi a Lyric function called from a thread Lyric does not run C called a Lyric function through its pointer on a thread the runtime does not know: one C started itself, which no collector attached. A Callback that returns nothing goes to the thread that made it; any other call — a function's, a Callback's that returns a value, one whose thread runs no scheduler — has no Lyric to run on, and the process ends. An export called before lyr_init started the runtime ends it the same way.
LYR-RT0023 P 13-abi a GcHandle that holds another class's object A GcHandle made again from C's pointer with GcHandle<T>.from was read, and the object its root holds is of another class than T, or the root holds none.

A.16 Lints

Every warning is a lint (16 §5): its name, its code, its group and its level unless said. warnings names them all.

Lint Code Group Level Title
assignment-in-condition LYR-SEM0202 correctness warn an assignment written as a condition
blanket-shadowing LYR-SEM0168 correctness warn a type's member hides a blanket member
boxed-interface-in-hot-loop LYR-SEM0222 perf allow a value boxed as an interface in a loop
broken-doc-link LYR-SEM0224 docs warn a doc link that names nothing
build-script-warning LYR-BLD0003 correctness warn a warning a build script reported
builtin-type-shadowing LYR-SEM0077 correctness warn an import that shadows a builtin type
closeable-never-closed LYR-SEM0144 resources warn a Closeable value nothing closes
comparison-always LYR-SEM0204 correctness warn a comparison of an unsigned value with 0 that cannot fail
dead-code LYR-SEM0201 unused warn a declaration nothing uses
deprecated LYR-SEM0076 deprecation warn a use of a deprecated declaration
deprecated-edition LYR-SEM0214 deprecation warn a construct an edition retires
exit-code-range LYR-SEM0210 correctness warn an exit code outside 0 to 255
float-equality LYR-SEM0205 correctness allow an equality test on floats
foreign-conformance LYR-SEM0211 correctness warn a conformance of another package's type to another package's interface
generator-copies-this LYR-SEM0172 correctness warn a 'mut fn' generator on a value type changes a copy
global-var-without-sync LYR-SEM0213 concurrency warn a module 'var' in a program that starts threads
int-literal-adapts LYR-SEM0208 correctness allow an integer literal that takes another type than int
irrefutable-pattern LYR-SEM0104 correctness warn a pattern that cannot fail where a test is promised
iterator-reused LYR-SEM0162 correctness warn a second loop over the same iterator
large-value-copy LYR-SEM0221 perf allow a large struct passed by value
loop-instead-of-while-true LYR-SEM0219 style allow 'while (true)' where 'loop' is meant
missing-docs LYR-SEM0223 docs allow a pub declaration without documentation
missing-module-docs LYR-SEM0225 docs allow a module without module documentation
module-shadowing LYR-SEM0207 correctness allow a local that hides a module the file imports
naming LYR-SEM0215 style warn a name against the naming convention
needless-return LYR-SEM0218 style allow a 'return;' that ends a body
prelude-shadowing LYR-SEM0153 correctness warn a name hides one of the prelude's
redundant-clone LYR-SEM0217 style warn 'clone()' of a value a copy makes whole
reserved-device-name LYR-SEM0216 style deny a module named as a Windows device
self-assignment LYR-SEM0203 correctness warn an assignment of a value to itself
shadowed-it LYR-SEM0209 correctness warn a block's implicit 'it' that hides the 'it' around it
shadowed-local LYR-SEM0206 correctness allow a local that hides one of the same name
string-concat-in-loop LYR-SEM0220 perf warn a string grown with '+' in a loop
unreachable-catch LYR-SEM0171 unused warn a catch-all clause that nothing reaches
unreachable-code LYR-SEM0073 unused warn an unreachable statement
unreachable-pattern LYR-SEM0112 unused warn a match arm no value can reach
unused-assignment LYR-SEM0199 unused warn a 'var' that is written and never read
unused-generic LYR-SEM0200 unused warn a type parameter that is never used
unused-import LYR-SEM0072 unused warn an import that is never used
unused-label LYR-SEM0103 unused warn a loop label nothing jumps to
unused-parameter LYR-SEM0198 unused warn a parameter that is never used
unused-result LYR-SEM0178 unused warn the value of a '@MustUse' call is dropped
unused-task LYR-SEM0212 resources warn a task's handle dropped
unused-unsafe LYR-SEM0234 unused warn an unsafe block that holds no memory operation
unused-var LYR-SEM0075 unused warn a 'var' that is never reassigned
unused-variable LYR-SEM0071 unused warn a local that is never used
useless-allow LYR-SEM0180 unused warn an '@Allow' that takes back nothing
useless-try LYR-SEM0139 style warn a 'try' mark over nothing that can throw
visibility-leak LYR-SEM0152 correctness warn a member is written wider than its type
void-binding LYR-SEM0173 correctness warn a binding or parameter holds a 'void'