Skip to content
Early preview. Maxon is under active development — incomplete in places, with breaking changes expected before a 1.0 release.

Error Codes

Every diagnostic the compiler reports carries a code, as in error E3014: path:line:column: message. The leading digit names the compilation stage that raised it. This page lists every code the compiler defines, grouped by stage, with the explanation its error-code registry records. The MCP server’s lookup_error_code tool looks up one code, or its case name, the same way.

Character encoding, string literals, escapes, comments.

A string literal reached end-of-line or end-of-file with no closing quote.

A backslash escape in a string or character literal names no known escape. A character or string literal whose text is not well-formed UTF-8 is refused too: \uD800, or a surrogate or malformed byte sequence typed into the source, is not a Unicode scalar value. Write \uFFFD where a placeholder is meant; bytes that are not text belong in a b"..." literal.

A literal brace appears unescaped in a string literal. A ‘{’ opens interpolation, so write ‘\{’ to embed a literal brace.

A block comment reached end-of-file with no closing delimiter.

The lexer reached end-of-file in the middle of a token.

A ‘#’ compiler directive names a directive the lexer does not know.

The lexer met a character that starts no token outside a string literal or a comment: ?, ;, |, &, $, %, ~, ^, a backtick, a control character or a non-ASCII character. Delete it, or move it into a string literal or a comment. A UTF-8 byte order mark at the very start of a file is accepted.

Syntax, grammar, block matching, expected tokens.

The parser met a token that cannot appear at this point in the grammar.

A type was required here and the token stream had something else. The compiler emits it where a name IS present but is not a usable type: a bare sized type as a typealias RHS (typealias I = i64). A type name the reading file cannot see is E3008 at every position it is written in. It also covers the shape where NO name is present and none can be inferred: an untyped closure parameter past the arity of the function type its call argument is declared with (nums.map(function(a, b) gives a + b), whose transform takes ONE parameter), so it has no declared slot to take a type from – see specs/closure-param-type-inference.md. An untyped parameter in a position that offers nothing at all is E2015 instead, which names the construct that does infer. A typealias’s implements clause naming anything but a ranged typealias is E2003 too.

An expression is not well formed, or is well formed and not usable where only a constant is. Broader than its name suggests: seven distinct message families report under it – a primary was required and the token stream had something else; a name in an expression has no binding in scope; a binary arithmetic/shift operator got a non-numeric operand; a unary ‘-’ got a non-numeric operand; a field default names no type; a var starts from a bare number; and a let starts from a number whose range is unknown. A top-level or static initializer reports them as a function body does. Every var – local, top-level or static – names its type. One whose initializer is a bare number (var x = 0), arithmetic over bare numbers, a plain let constant, or an array, map or tuple literal of bare numbers with no typed head is refused at the initializer: cast it (var x = 0 as Tally, var size = (16 * 1024) as ByteCount). A let of a bare number, of arithmetic over bare numbers or of a literal container is a constant that fits any alias its value fits, checked at compile time at each use. A let of a number whose range the compiler cannot know (let w = 1 shl k) is refused: let w = (1 shl k) as Width. A field with a default takes its type from the default, which is a true/false or string literal, Type.member or Type.member(...) (typed Type), or an expression whose outermost node is a cast (var count = 0 as Tally). A bare number (var count = 0), a bare global, and a + 1 as Tally (which is a + (1 as Tally)) are refused: cast the whole default, (a + 1) as Tally.

The parser reached end-of-file with a construct still open.

A block’s ‘end’ label does not match the label its header opened.

A specific token was required here. Reports as: Expected ‘X’ but got ‘Y’. A declaration never writes a type before its =, so var x as T = e is refused here in every declaration: a field reports Expected newline but got '='. Write var x = e as T; a field with no default keeps var x as T.

A literal is outside every type it could have: an integer below i64.min or above u64.max, or a float beyond the float range. An integer literal above i64.max is legal only where a type whose range admits it receives it – a cast, a typed parameter, field, slot or return, a range bound, an operand beside such an alias, an arm or otherwise fallback merged with one, or a float slot. Anywhere else it is refused here: write it with a cast, 18446744073709551615 as Quantity for a typealias Quantity = int(0 to u64.max). Into a signed or narrower alias it is E3005.

A declaration cycle: something is defined in terms of itself. Broader than ‘import cycle’, which is one of several shapes all three compilers report under it – others are a cycle among top-level constants (‘let A = B + 1’ / ‘let B = A + 1’), where no initializer can be evaluated because each waits on the other, a cycle among initializers that run before main (a static reading another, directly or through a function it calls, or reading its own field), and a circular typealias (‘typealias A = Array with A’, or a mutual pair), which describes an infinite type with no finite layout. The list is not a roster to keep exhaustive: what the code means is the cycle, not the construct it was found in.

An assignment targets a let binding, a let field, a for counter or variable, a match or if let binding, a parameter, or an element of a let tuple. A let is a name that is never reassigned, so the message reads 'x' is a let and cannot be reassigned, or 'f' is a let field and cannot be reassigned for a field; a number, bool, enum or String held by a let cannot change either, since changing it is reassigning it. Passing a let to a mutable parameter is refused here too, because that parameter reassigns the caller’s variable ('n' is a let and cannot be passed to the `mutable` parameter 'x'; bind it to a `var` ). Declare the name ‘var’, or do not reassign it. Writing through a let (a field store, push, a callee that writes its parameter) is not a reassignment and is accepted. A parameter is a let binding, whether the statement assigns it, stores a fresh record in it or calls a method that writes its value in place (s.append("!") over a String parameter). A parameter of a value type (a number, bool, an enum or String) is marked mutable before its type to be reassigned, which makes it a by-reference parameter. A record-type parameter, and a parameter whose type is a generic body’s type parameter, is never rebound, marked or not: copy it into a local var, or return the new value. A field store through a record parameter is not a reassignment. A payload binding of a match is a place in the matched union: assigning it replaces the payload that union holds, so the union must be one the function can write. That is a local var, a field of a var or of a record parameter, or a parameter marked mutable. A union parameter without the marker is refused with the parameter named: mark it mutable, or copy the union into a local var and match on that. The receiver self, a temporary and any other union nothing holds are refused the same way, and the fix is to copy the union into a local var. An assignment to a method, a requirement or a static the compiler provides (Ops.twice = f) is refused here too: a method is not a binding, and only a binding is assigned. A mutable parameter is by reference: the callee overwrites the caller’s own variable, so the argument must be a place the caller can write, a local var or a field or element of one. Refused here: a literal or an expression (cannot pass a literal to a function that writes argument 1), a parameter that is not marked mutable, a module-level let, a field of a let that is another name for a record held elsewhere, and a name a closure captured, since the closure holds its own copy and the write could not reach the original. Bind the value to a local var and pass that, or pass a clone().

One parameter list declares the same name twice. The second parameter would be dead and uncallable.

The source uses a language construct this compiler does not implement yet. It also refuses a user declaration of a type name the compiler owns, such as String, ExitCode or the literal marker interface BuiltinStringLiteral: rename the declaration. A call to a generic type’s static function that needs the instance’s element count or where witness tables is refused here when the call names no instance and the calling function holds none to hand on: call it through a typealias that names the instance (IntBox.make()), or from a method of the type. An async call of a function that reads its enclosing instance’s layout descriptor is refused too, because a spawn hands the new thread its written arguments only: call it directly. A declaration with more members than its layout can number in sixteen bits is refused too: more than 65,535 fields in a type, cases in an enum, payload fields in one case, requirements in an interface (its inherited ones included) or elements in a tuple, or more than 65,536 backing entries written for one enum case. Split the declaration. A function with more than 64 argument slots – its declared parameters, defaulted ones included, plus the hidden ones the ABI adds – is refused at its name, and a call with more than 64 arguments at the call. An extension of a typealias is refused here too: extend the type, enum, union, interface or primitive it names. So is a static function in an enum or union or in an extension of one: declare it as a free function. A container element held at an interface type (Array with Named, Box with Named) is refused once, where the instance is written, however many uses a typealias that names it has: an element slot is one machine word, and a value at an interface type is two. A conformer that binds an associated type to an interface (implements Source with Named) is refused at that binding when an extension of the interface, a standard library one included, stores the associated type as a container element (extension Iterable’s ElementArray). Declare the element, or bind the associated type, at a concrete type that implements the interface. A method of a generic type that widens an instance built over the type’s own parameters to an interface (Gen with T returned as a Sink inside type Wrap uses T) is refused when the instance’s methods reach the enclosing type again, because its witness table at a concrete instantiation would be an unbounded chain of ever-deeper instances. Give the type argument a concrete type, or pass the value it wraps as a type parameter of its own. A program with a share door (E3171) is refused the same way, with the same fix, where the instances the door must judge grow without end: a generic type that names an instance of itself whose type arguments nest its own type parameters deeper, or a conformer that binds an associated type an interface holds to such an instance.

A character literal is malformed (empty, or holding more than one character).

A match arm falls through to the next arm while the enclosing function still owes a return.

A match does not cover every case of its scrutinee and has no default arm.

Two match arms test the same pattern; the second can never run.

A match’s arms, or a ternary’s two branches, produce different types (or a ternary condition is not bool). a match arm or postfix-ternary’s two arms produce different types, or a ternary condition is not bool. Thrown at parse time so it wins over the body-finish unused-variable check (E3012). Two declarations of one typealias name are two types, so arms giving one each disagree; where the two would print alike each is followed by (declared in <file>).

A match’s ‘default’ arm is not the last arm.

A match arm opens a block but gives it no block label.

A match arm’s block label does not match the label its arm opened.

A top-level constant’s initializer is not a compile-time constant. A top-level or static binding that holds a scalar – a number, a bool or an enum case – is a constant inlined at every use, so its initializer must have a value known at compile time, as 2 * WIDTH or sqrt(4.0) does in a function body. A call whose result is not known there is reported here, naming it: a free function or sibling static returning a scalar, an instance method called bare, a generic function, or a function-typed binding. A call to a function that does not exist, that the file cannot see, or that several directories declare is E3004, E3008 or E3095, as in a function body. Make the call inside a function.

A match over an enum may only carry a ‘default’ arm if that arm throws.

‘break’ or ‘continue’ appears outside any loop, or targets a label that names no enclosing loop.

‘break’/‘continue’ carries the label of the construct it already leaves. The label is redundant. break 'lab' / continue 'lab' where lab names the innermost enclosing loop (with no intervening match for break), or, for break, the innermost enclosing match. Unlabeled break/continue already targets it; a label reaches an outer loop. Emitted from resolveControlTarget.

A match arm’s body is a block-opening statement. Each arm body must be a single statement. A match arm body cannot be a block-opening statement (if / while / for / match / block-form try). Each arm body is a single statement; block-form constructs would allocate persistent slots that leak on every error path through the match.

An ‘otherwise’ block form declares no error binding. TWO messages on one code: a block-form try 'l' ... end 'l' with NO otherwise handler at all, and one whose handler declares no (e). The author’s mistake is one thing – an incomplete handler – told apart only by how far they got.

A declaration uses a name reserved by the compiler. THREE messages on one code, because what is reserved and why differs while the author’s mistake does not: a __-prefixed declaration (the space the compiler emits its own symbols into), a binding of self (the implicit instance receiver), and a FREE FUNCTION named maxon_force_segfault (the fault-probe entry point the compiler emits a call to). Only the last is scoped to one name space – the other two are refused at every binding site.

A call labels its first argument, and the callee’s first parameter has no default. A first argument may carry a ‘name:’ label only when the callee’s first parameter – after a method’s receiver, or a message’s ‘self’ – declares a default. Against ‘function connect(port Integer = 80, retries Integer = 3)’, ‘connect(port: 8080)’ and ‘connect(retries: 5)’ are both legal; against ‘function f(a Integer, b Integer)’, ‘f(a: 1, b: 2)’ is refused. Write a required first argument positionally: ‘f(1, b: 2)’. An enum payload declares no defaults, so its first argument is always positional.

A call leaves a second-or-later argument unlabeled. Every argument after the first must carry its ‘name:’ label.

A shift (‘shl’/‘shr’) whose count the compiler FOLDED and found NEGATIVE – ‘a shl -1’, ‘a shl -(1)’, ‘let SHIFT = -1’ … ‘a shl SHIFT’. A negative count is not a shift the other way: the hardware MASKS it, so ‘a shl -1’ silently computed ‘a shl 63’ – the MAXIMUM LEFT shift, a wrong answer with the opposite sign. Maxon follows Go: the count must be non-negative; a constant one is this compile error, and one that only appears at RUN TIME panics. WARNING – a count of 64 OR MORE IS NOT THIS ERROR. It is a legal, well-defined shift that moves every bit out (‘x shl 64’ == 0), because Go puts no upper limit on a shift count. This code briefly rejected it, which OVER-rejects a correct program. The compiler SATURATES such a count instead of masking it. A PARSE-time check, positioned at the count as WRITTEN. It asks the CONSTANT FOLDER, not the token shape: ‘let SHIFT = -1’ is the same -1 as the literal, and a check that only looked for a bare literal token missed its own motivating example.

A ‘Base with Args’ instantiation names a ‘Base’ that declares no type parameters – a non-generic type, or a name that is not a generic ‘type’ at all. Reports as “Type ‘X’ has no associated types”.

A generic instantiation supplies the wrong number of type arguments – ‘Pair with Integer’ where ‘type Pair uses A, B’ expects two.

A test declaration appears in a file whose name does not end in .maxtest. Tests belong only in test files, so which declarations a build carries is answerable from the file list alone – no flag, no attribute, nothing to read the body for. The message names the fix: rename the file to its .maxtest name, or move the declaration into a .maxtest file.

A test declaration’s name is the empty character literal (test ''). The name is the test’s whole identity – it is what the reporter prints and what end '' must match – and an empty one names nothing. Refused at the declaration rather than at the report, where an unnamed failure would be the least useful place to discover it.

E2060 — parserCallerLocationOutsideDefault

Section titled “E2060 — parserCallerLocationOutsideDefault”

‘__line__’ or ‘__file__’ appeared somewhere other than a function parameter’s default value – in an ordinary expression, or as a struct FIELD default, which is a different thing despite the shared ‘= <expr>’ spelling. These two are a CALLING CONVENTION, not a reflection facility: each expands at the CALL SITE, and a parameter default is the only position that has a call site to expand against. A field default expands at a struct literal and an ordinary expression expands nowhere, so neither has an answer to give. Raised at TWO grammar positions, from one rule: the expression position catches it when the token is evaluated, and the field-default position catches it when the tokens are CAPTURED. The capture-side check is not merely a better error location – without it a field default nobody triggers is never expanded, and the misuse would go undiagnosed.

A ‘Base with Args’ instantiation supplies a BARE numeric primitive keyword – ‘Box with int’, ‘Array with float’ – where the ranged-typealias rule requires a declared domain (‘typealias Integer = int(i64.min to i64.max)’, then ‘Box with Integer’). It is the same rule every other type position already enforces, reaching the one position that never did. ‘bool’ is DELIBERATELY ADMITTED and is not this error: it is already a constrained type with nothing to range. So are ‘String’, a user ‘type’/‘enum’, a type PARAMETER, a nested instance and a ranged alias – this names ONLY the two bare numeric keywords. Distinct from E3011 (unknownType), which means the name resolves to NOTHING; here it resolves to a real type that is forbidden in this position. Distinct from E2062: a bare ‘float’ is BOTH a bare primitive and a float, and E2062 claims it, because THIS code’s advice (“declare a ranged typealias”) is true for ‘int’ and a trap for ‘float’. So this code only ever names ‘int’.

A generic type argument resolves to ‘float’ – bare (‘Box with float’) or through a ranged float typealias (‘typealias Real = float(…)’ then ‘Box with Real’). The compiler DICTIONARY-PASSES rather than monomorphizing, so a type parameter is one opaque 8-byte GENERAL-PURPOSE slot; a float value is born in a floating-point register and has no way to travel through it. Reaching the backend, it panicked on the x64 emitter’s cross-register-file assertion. It is a compiler limitation, not a language rule, and the message says so rather than naming a workaround – there is none at this milestone. It is asked BEFORE E2061 so a bare ‘float’ gets this message and not the ranged-typealias advice, which would direct the reader into the very panic this refusal exists to close.

A ‘#if’ / ‘#else’ / ‘#endif’ region is structurally unbalanced: a ‘#if’ still open at end of file, or an ‘#endif’ / ‘#else’ with no ‘#if’ to close. Accepting them is a wrong-answer generator, not a leniency: an unterminated ‘#if’ silently SWALLOWS the rest of the file, so every declaration after it vanishes and the only symptom is an unrelated ‘undefined’ further on. The compiler refuses, naming the position of the directive that has no partner.

A ‘#if’ condition names a conditional-compilation predicate that does not exist – anything other than ‘os’, ‘arch’, ‘testing’, ‘rcSanitize’ or ‘leakReport’. Distinct from E1009 (lexerUnknownDirective), which names an unknown DIRECTIVE (‘#wibble’, a bad token); this names a known directive whose CONDITION calls an unknown function. An unknown ARGUMENT to a KNOWN predicate (‘os(Plan9)’) is deliberately NOT this error – it evaluates to FALSE, letting a condition name a platform this compiler does not target without becoming a build failure. Names ONLY the unknown-name fault. A condition the grammar cannot READ at all – a missing ‘)’, an operator with no right-hand side, text trailing the condition – is E2065, because ‘your predicate name is unknown’ is the wrong advice for a missing paren.

A ‘#if’ condition the directive grammar has no production for. Two shapes reach it: the condition itself does not parse (a missing ‘)’, an ‘and’ with no right-hand side, a bare ‘true’ where a predicate call belongs, a condition that runs off the end of the file), or the condition parses but TEXT FOLLOWS IT on the same line. Distinct from E2064, which names a different fault: there the condition reads fine and the function it calls does not exist, and the fix is to correct a NAME. Here there is nothing to look up, so one code answering both would tell a reader with an unbalanced paren that their predicate name is unknown. The trailing text is REFUSED rather than discarded. Accepting it is a wrong-answer generator: the tokens after the condition are emitted into the program as code, so ‘#if os(Windows) os(Linux)’ is a hard error on Windows and silence on Linux, where the region is dead and the junk is skipped along with it. A condition ends at its own newline.

A conformance’s PARENTHESIZED ‘with (…)’ list binds more arguments than the interface declares ‘uses’ names – ‘type Holder implements One with (Integer, Float)’ against ‘interface One uses A’, which bound A := Integer, silently DROPPED Float and compiled clean (measured, exit 42): a typo nothing reported. DELIBERATELY ASYMMETRIC, and the asymmetry IS the rule. The same surplus written WITHOUT parentheses is still ignored, because the two spellings are not the same claim: parentheses make the list explicit, so its LENGTH is something the author asserted and can be wrong about, while unparenthesized the length is decided by the interface’s ‘uses’ arity and a trailing comma legitimately belongs to the outer ‘implements’ list. Exactly ‘arity’ items are consumed in the unparenthesized form, and ‘surplus-conformance-argument-is-ignored’ pins it. NOT E2056 GenericArityMismatch, which is a different construct with a different rule. That one is a generic INSTANTIATION (‘Pair with Integer’ as a type reference) and its arity is SYMMETRIC – too few is the same error as too many. Here too FEW is a different diagnostic entirely (E3016, naming the first UNBOUND associated type, raised whole-program by ConformanceCheck), and too many is refused only in one of the two spellings. One code over two rules that agree on neither symmetry nor spelling would document neither. It is NOT raised when the interface name resolves to nothing: a name no file declares has no arity to be surplus of, and the program’s real error is E3015 ‘implements unknown interface’.

A call to a bare compiler BUILTIN labels one of its arguments – ‘min(3.0, b: 5.0)’. A builtin’s arguments are ALL POSITIONAL, at every index, because a ‘name:’ label names a PARAMETER OF A DECLARATION and a builtin has no declaration to have parameters. Nothing downstream could check such a label either: a builtin emits no call op, so it never reaches the slotting that validates a label against a callee’s parameter names. NOT E2052/E2053, and that is the whole reason this code exists rather than reusing one of them. Both of those state the declared-call rule, which speaks of a callee’s parameters and their defaults – and a builtin has no parameter at any position. Reusing E2052 here would answer a labelled second argument with a sentence about the first. It fires only for callees whose arguments this compiler decides are positional, and that decision is stated in exactly ONE place, ‘Parser.argLabelRuleForCallee’. TWO disjoint families answer that way, for the same reason and by different tests: the MATH intrinsics (‘calleeTakesPositionalArgsOnly’), each of which IS a machine instruction; and every ‘__Builtins.’-qualified callee (‘isBuiltinsIntrinsicCallee’), which the stdlib WRAPS and never declares. Neither will ever acquire a declaration to take labels from. It covers the arity-1 members as well as the arity-2 ones, because the same wrong noun would otherwise survive one door over: ‘abs(x: 1.0)’ would answer E2052, whose sentence blames a default on a parameter the builtin does not have. It is NOT ‘every builtin’. The bare builtins that are NOT in that roster stay on the declared-call E2052/E2053 rule – today ‘spawnReadLine’ and the seven ‘subp*’ streaming-subprocess builtins. Every one is a STAND-IN for a stdlib declaration that will have real, labellable parameters – ‘subpWriteLine(h, line: s)’ already LABELS its second argument on purpose, written the way the eventual method call will be written. ⛔ DO NOT TRUST THAT LIST; READ ’Parser.parseCallNamed’s CHAIN. This sentence is a PROSE COPY of a roster, and it carries NO COUNT: a count here goes stale the moment a builtin is retired onto a stdlib declaration, which takes it out of the chain entirely and hands it the ordinary declared-call rules. The set that DOES bind is stated in one place, ‘Parser.calleeTakesPositionalArgsOnly’; everything else the chain recognizes is the complement of it. ⚠ AND THAT ROSTER IS NOT THE WHOLE OF THE BINDING SET. ‘Parser.argLabelRuleForCallee’ is the one place to read; ‘calleeTakesPositionalArgsOnly’ is one of its two arms. The ‘__Builtins.’ arm is a QUALIFIER test and not a roster, deliberately: the label regime is chosen while the argument list is still being parsed, so a ‘__Builtins.’ name this compiler does not implement parses positionally and meets E3004, rather than a label complaint standing in front of the true diagnostic.

A numeric literal’s text is not a number – two decimal points (‘1.5.3’), or any byte the number grammar does not admit. IT IS A DIAGNOSTIC AND NOT A PANIC, because a malformed literal IS reachable from source: it is tempting to argue otherwise from Lexer.scanNumber handing over only digits, ‘_’, ‘.’, ‘e’/‘E’ and an exponent sign, but the lexer’s trailing-byte rule can append a SECOND ‘.’ to a token that already carries a fraction, so ‘1.5.3’ reaches the reader as ‘1.5.’. A parser must be able to answer ‘that literal is not well-formed’ with a position, and a layer that cannot say no is a layer whose caller’s leniency has nowhere to surface.

A ‘FixedArray’ element count runs from 1 to 4294967295, and the program states one outside that range or spells it as something other than an integer literal. The message names the fault: “its element count is N” (0, a fixed array of no elements, or a count too large for the compiler to fold into a buffer allocation); “create’s length is the constant N” (a constant length given to the ‘create(n)’ of a runtime-sized fixed array that is 0 or above 4294967295); “the element count of a FixedArray type is an integer literal, not X” (a name, a signed number or a fractional number written where the count goes: ‘FixedArray with K Int’, ‘FixedArray with -3 Int’, ‘FixedArray with 3.5 Int’). Write an integer literal in range, as in ‘FixedArray with 3 Int’. A count is part of the TYPE (‘FixedArray with 3 Int’ and ‘FixedArray with 4 Int’ are different types). A missing count, ‘FixedArray with Int’, is the runtime-sized form, whose length each value carries and ‘create(n)’ states, so it is not this error. This code is NOT E2056 GenericArityMismatch, which counts TYPE arguments – the count is a value, is consumed before the type-argument list is read, and a ‘FixedArray with 3’ missing its element type IS the E2056 that code names. It has a code of its own so the one rule has one message wherever the spelling is met.

A ‘__Builtins.ucd*’ load names a compiler-owned Unicode table its intrinsic does not read. Each intrinsic reads exactly ONE table, because the label and the STRIDE are one fact: ‘ucdByteAt’ reads ‘__ucd_bmp’, one byte per BMP codepoint, and ‘ucdI64At’ reads ‘__ucd_supp’, an array of 8-byte packed range entries. Reading either with the other’s stride cannot produce an answer – only a wrong one – so the pairing is refused rather than assumed, and the message names the table the intrinsic DOES read. ⚠ IT IS A SECURITY GUARD AND NOT A TYPO CHECK, which is why it is a refusal at the label token rather than a link failure later. The label becomes a FILE NAME under the stdlib directory, so an unchecked one is a PATH TRAVERSAL. A ‘__ucd_’ PREFIX check does not close it: ‘__ucd_../../x’ carries the prefix and still escapes. A ROSTER of the tables the compiler actually owns is what closes it. NOT E2010: a label that is not a string LITERAL at all is refused at the token by the ordinary ‘expected a string literal’ rule, because that is a shape the parser can state without knowing which intrinsic it is reading for.

A qualified name reads or calls a member its base does not have: Config.MIN_SIZE where Config declares only MAX_SIZE, int.nope(), or Status.big where Status is a ranged alias. The base may be a declared type, a primitive, a compiler-owned type (String, __ManagedFile), a container or SharedValue alias, a ranged, function or tuple alias, an interface, a type parameter or a directory, and the message says which; where the base has a fixed set of statics, it lists them. Reported at the member. Only a sized type (u8 to u64, i8 to i64, f32, f64) has .min and .max, and a ranged alias declares no members. Correct the member’s name, or reach it through what declares it: a static of a generic type through the type itself (Box.make, not IntBox.make), a static requirement through a concrete type that implements the interface, and an instance requirement on a value.

A .maxproj file sits below another project’s directory: a directory above it holds a .maxproj of its own. Projects do not nest, so a build refuses the pair from either end – building the outer project, or building the inner one – and the editor reports it on the inner .maxproj. Move the inner project out of the outer project’s directory.

A method is named without its call where a value is wanted: apply(Ops.twice, x: 21). Type.method names a method – a static one, an instance one read through its type, a static the compiler provides (int.fromString, __ManagedFile.openRead), or a requirement read through a type parameter (T.make) – and a method is not a function value. Only a free function’s name or a closure is. Wrap the call in a closure: function(n) gives Ops.twice(n). An instance method is called on a value, function(value) gives value.size(), and a requirement on a concrete type that implements its interface.

A cast’s operand is itself a cast: x as A as B, or (x as A) as B through any parentheses. Cast directly to the final type, x as B. When both steps do work, such as a range check followed by a reinterpretation as a bits(n) pattern, bind the first result: let a = x as A, then a as B.

A return is written in a top-level or static binding’s initializer, as in a handler block: let LEVEL = try parse(3) otherwise (e) 'h', then return 3. An initializer is not a function, so return has nothing to leave. End the handler with panic(…), or give the try a fallback value: let LEVEL = try parse(3) otherwise 3.

A block is labelled with the label of a block that encloses it, or with the name of the function, method or type that holds it: if x 'flipped' inside function flipped, or a second 'scan' loop inside a 'scan' loop. An end '<label>' closes the innermost block it names, so a repeated label leaves the closer ambiguous. Rename the inner block’s label. Blocks that do not enclose one another may share a label.

Type checking, borrowing, visibility, declaration lookup.

The program declares no ‘main’ function.

An entry function declares a return type other than ExitCode: a program’s main, or any exported or public function of a .maxproj or .maxtasks, each of which is a target or task and is checked on every build or run of that file. A program’s own typealias ExitCode is accepted as the return type when it is an integer alias whose range fits the builtin ExitCode’s (0 to 255, 0 to u32.max on Windows). Make the function return ExitCode; in a .maxproj or .maxtasks, a function that is a helper rather than a target or task drops its export (or public) instead.

A call names a function that does not exist – a typo, or a callee not visible from here. A dotted call, whether written as an expression, a statement, under try or async, or in a top-level constant, is reported here when its qualifier names no binding, directory or type (foo.bar.baz(): nothing declares foo.bar). Correct the qualifier to the directory or type that declares the function. A bare call in a top-level or static initializer is reported here as it is in a function body. This is the one error the call earns: the value it produces is accepted wherever it is used. A member called on its result has parameters no declaration states, so it accepts any argument labels and an untyped closure argument; errors inside its arguments are reported as usual.

A value’s type does not match the type required at this position. Both sides are named as their declarations wrote them, so a ranged or float alias prints as the alias on either side: an argument (expected 'Digit', got 'bool', got 'Ratio'), a return (declared to return 'Digit', Cannot return 'Digit' from function declared to return 'bool') and an assignment (which holds 'Digit'). A float alias value at an integer alias place is a mismatch between two aliases and is reported here; E3009 reports a float-to-integer conversion where at most one side is an alias. Every typealias declaration is its own type, whatever its form: two aliases over one range are two types, and so are two declarations of ONE name in two files, even over the same range, shape or instance. Mixing them – an operator, an argument, a store – needs an explicit as; a return converts as it does between any two aliases. A type is named as source would qualify it: the standard library’s as stdlib.Name, another directory’s as dir.Name, the root’s bare. Where the two sides would still print alike, each is followed by (declared in <file>), and a buffer view reads __ManagedMemory with <element> followed by (the view of 'Name'). A mismatch between two integer-range types (a ranged integer alias or ExitCode) ends with the cast that fixes it: — cast the argument with 'as Year' at an argument, a builtin’s included, and — cast the value with 'as Year' at a store (a variable, global, field, tuple element, struct literal or union payload). The hint ends only a diagnostic whose expected type carries no (declared in <file>) note, because in the reader’s file as Year could name the other declaration. A constant outside an alias’s range is reported here too, including an integer literal above i64.max written into a signed or narrower alias (9223372036854775808 as Offset for an int(i64.min to i64.max) Offset). So is a range that cannot be declared: an empty one (int(0 to -1)), one whose lower bound is above i64.max, or one spanning negative values and values above i64.max. A plain let constant, a loop counter between two literal bounds and a value computed from either carry the range their values can have, integer or float, and a use that reaches an alias that range leaves is refused at the use (Value 400 is outside the range of 'Small'). A literal container whose bare integer elements need both a negative value and a value above i64.max ([-1, u64.max]) has no common integer type: cast the elements to an alias. A constant FixedArray index at or past the size is reported here too (Value 3 is outside the range of the indices of 'FixedArray with 3' (int(0 to 2))): correct the index. So is a constant +, - or * over a full-width unsigned alias (int(0 to u64.max)) whose result leaves the range (The result of 2 - 3 is outside the range of 'Count' (int(0 to 18446744073709551615))): correct the constants. The same operation over runtime values is range-checked where it is computed. A brand is part of a type. Values of two brands over one instance are compared, merged or stored into one place only through a cast (xs == ys for an Xs and a Ys); a Self parameter takes the receiver’s brand, while inside a generic type a parameter spelled with the bare base (other Box) fits every brand of the instance. A tuple element keeps its brand. A var born from an unbranded value takes the brand of the first branded value stored into it – the first in source order, and for a module var the first in the program’s file order – and a later store of another brand is refused (cannot assign a value of type 'Ys' to variable 'a', which holds 'Xs'). An array-literal element is held to the literal’s element type exactly as push holds an element, brand and enum included (argument type mismatch for 'value': expected 'String', got 'int'). The source of a Set from or List from written without brackets is an Array, and under an alias head an Array of exactly the alias’s element (argument type mismatch for 'source': expected 'Array with Code', got 'int'): pass such an array, or write the members as a literal. A variable handed to a mutable parameter flows both ways, since the callee may write any value of the parameter’s type back, so the variable is declared at exactly the parameter’s type, alias identity included: a Narrow variable at a mutable Wide parameter and a Wide variable at a mutable Narrow one are both refused. Declare the variable at the parameter’s type, or pass a local of that type.

A name is declared twice where exactly one declaration is legal: a top-level name twice in one directory, a method, field or requirement twice in one type, a local shadowing a ‘self’ field, two generic instantiations compiling to one name, or a member the compiler supplies to a type declared again by a layer above the type’s own. Five shapes share the code: (a) a top-level name declared twice in one DIRECTORY. A type, enum, union, interface, typealias, top-level let or var, and function all claim their name in one namespace per directory, whether unmarked, export or public and generic or not, so type Point and function Point collide, in one file or across the files of a directory (duplicate definition of 'Point' -- already declared as type Point``). A pair of typealiases that collides is E3061 rather than this code. Another directory’s declaration of the name is a separate scope and never collides, and a local or a parameter may shadow a top-level name; (b) a method or a field declared twice in one type, a field and a method sharing a name, or a requirement declared twice in one interface. A static and an instance method of one name are two declarations of it, and so are a method of a type and a method an extension of the type adds (Duplicate field 'count' in type 'Counter', Duplicate method 'add' in type 'Counter', 'total' names both a field and a method of type 'Counter'); (c) a local declaration inside an instance method whose name collides with a self.field (the local would silently shadow the field); (d) two generic instantiations that compile to one name. An instantiation has no source name, so the compiler joins its base to its arguments (Box with String -> Box_String) and derives every per-type symbol from that string; _ is a legal name character, so the join is not injective (Pair with (Box_Int, Str) and Pair with (Box, Int_Str) both compile to Pair_Box_Int_Str). Fires from checkTypeSymbolNamespace in the compiler, whole-program, after the instantiations are interned; (e) an extension of a type, in a layer above the one that declares the type, declaring a member the compiler supplies to that type. The layers are the standard library, the scriptlib packages and the program, lowest first, and the members are hash and equals of a payload-free enum, clone of a struct or of a union with payloads, toString and clone of a primitive, and a primitive’s static such as int.fromString (Duplicate method 'hash' in type 'ParseError': the compiler supplies it to 'ParseError', and a layer above the one that declares 'ParseError' may not declare it), whatever the member’s signature. Rename the method, or wrap the type in a type of your own that declares it. An extension of an interface declares a default, which yields to a member the compiler supplies to a conformer, in any layer, as it yields to a member the conformer declares. For (a) and (b) the declaration kept is the earlier one within a file, and across files the one in the file whose absolute path, with / separators, sorts first byte by byte; each other one is reported at its name. Rename one declaration.

A symbol is referenced from outside its declaring directory’s subtree but is not declared ‘export’. An unmarked declaration is visible to every file in its declaring directory and that directory’s subdirectories, and to no other file; program code and the standard library never see each other’s. It covers a function, a static member, a type and a typealias – a type body’s inner typealias too, which is unexported unless it carries its own modifier, and is refused written bare or qualified (Holder.Inner) – at every position a name can be written in: a type annotation, a cast target, a construction or static call head, an implements, extends, where or throws clause, a from head, a spawn’s factory, and a top-level or static initializer. A type the reading file may not name hides its members too: its fields, methods, extension methods, accessors and statics are refused through a value of it that reached the file, and so are the calls the compiler makes on that value’s behalf – interpolation, == and ordering operators, for iteration, and a match over a hidden enum or union. A file that writes the type’s name, or a hidden alias of it, gets the one refusal at the written name; a value that reached the file without its name being written is refused at its member use. A value of a hidden interface type exposes none of its requirements. A value held at an exported interface answers that interface’s requirements whatever type stands behind it, and so does a library witness dispatch such as a sort’s comparison. Export the declaration, or reach it through an exported function or interface.

A conversion that cannot be proven safe: an explicit cast whose source range does not fit the destination (256 as Byte), an explicit cast that is lossy or meaningless (5.0 as int, true as int), or the SAME lossy conversion reached IMPLICITLY, where a value meets a declared type it cannot reach without loss (takeInt(3.7), return 3.7 from a returns int). One code, because it is one fact: the answer to every one of them is an explicit trunc/round/floor/ceil. A cast that would forge a value is refused here too: an integer cast to an enum (use Enum.fromRawValue(raw), which throws noSuchRawValue for a value no case carries) or to a union (build it with its case constructor), and an interface value cast to another interface. A tuple converts element by element, each element through the cast its own type would take, so a tuple cast is refused here when the cast of one of its elements would be ((Color, Wide) as (Wide, Wide)), and when the two tuples have different numbers of elements.

A cast converts nothing: it names the type the value already has – its own typealias (b as Byte on a Byte), a full-range alias included, or its own struct, enum, union, bool or String – or it casts a numeric literal that fits to the very typealias its destination declares – a call argument, a return, a struct-literal field or a store to a declared field (open(8080 as Port) where open takes a Port). Remove the cast. So is a literal cast in an unannotated let when every use of the let takes the plain constant the same way: let limit = 10 as Count read only where a Count is declared. A top-level let keeps its cast, and so does one a closure captures. A literal cast stays legal where it is what fixes the type: an unannotated var, a let some use of which needs the alias, a field default whose cast gives the field its type (var count = 0 as Tally), an array-literal element, a generic parameter, an operator operand. A field default that already names its type takes no cast to it: var gauge = Gauge.make() as Gauge is refused. A cast to an alias the value’s own alias implements, directly or through its parents, is legal: it retypes the value as that ancestor. A cast between two declarations of one name in two files converts, and is legal too. Reported once the program has no other error, beside any target refusal (E3074, E3104).

A named type resolves to no declared type – a typo, or a type this compiler slice does not have. The name after extension is one too: it must be a declared type, enum, union, interface or primitive.

A local binding is declared and never read.

A value-returning function can reach its end without returning, or a ‘return’ in it carries no value. A while true loop that no break targets has no end to reach, so the returns inside it satisfy the function.

A field not declared ‘export’ is read or written from outside its type’s declaring directory subtree. The gate is the type’s DIRECTORY, and it covers WRITES as well as reads: another type, a free function or an extension in that directory or below it reads and writes the field, and a reader anywhere else is refused, v.secret = 42 exactly as return v.secret. Initialization is exempt: every field, exported or not, may be named in a struct literal, because the type itself determines what fields exist and visibility only governs access AFTER construction (specs/export-var-fields.md).

An ‘implements’ clause names an interface that does not exist.

A type, enum or union claims to implement an interface but does not define all of its members, or defines one whose signature differs from the requirement’s. The expected signature names each associated type by the with argument the conformance spelled, and each type as the source spells it, a typealias by its own name. A typealias of a generic instance is its own type: a requirement taking or returning IntArray is not met by a member spelled with another alias of the same instance. A declared type is not the generic instance its name resembles: a type Array_Byte neither meets nor is met by ByteArray.

E3017 — semanticWhereConstraintViolation

Section titled “E3017 — semanticWhereConstraintViolation”

A generic argument violates the ‘where’ constraint declared on the type parameter.

A field access names a field the type does not have.

An enum declares the same case name twice.

Two enum cases declare the same raw value.

An enum case’s raw value has a type other than the enum’s declared raw-value type.

A match arm names a case the scrutinee’s enum does not have.

A match arm’s payload-binding pattern supplies the wrong number of bindings for the case’s payload. a match-arm payload-binding pattern (case(x, y)) supplies the wrong number of bindings for the case’s declared payload. Emitted at parse time by parseCasePayloadBindings, and by requireErrorUnionBindingCount for an error-union pattern.

A call passes a different number of arguments than the callee declares parameters.

A call’s ‘name:’ label names no parameter of the callee.

Two arguments of one call target the same parameter.

An entry function is declared ‘throws’: a program’s main, or any exported or public function of a .maxproj or .maxtasks, each of which is a target or task and is checked on every build or run of that file. There is no caller left to handle the error. Remove the throws clause; in a .maxproj or .maxtasks, a function that is a helper drops its export (or public) instead.

‘try’ is applied to a call that cannot throw. A / or mod whose divisor is proven non-zero and a FixedArray get/set whose index is proven inside the size cannot throw: the proof is a constant, a ranged type whose range lies inside, a counted-loop counter between compile-time bounds, or a value computed from those, such as their sum, difference or product. Drop the try … otherwise. So is try spawn Type.factory(…) of a factory that cannot throw: that spawn returns the handle at once.

A throwing call, a call to a throwing interface method, or an await of a throwing promise is made without ‘try’ where nothing catches its error. Inside a block-form try or a test body no try is needed: the block’s handler or the test takes the error. A closure written inside a test is not the test’s body, so it still needs one. Write try f() otherwise …, propagate with a bare try from a function that throws the same error type, or move the call into a try block. Every message sent to a service is such a call, because a send fails at once with <Service>.<message>.sendError when the mailbox is full or the service has stopped. So is a FixedArray get/set whose index is not proven inside the size: write try, or give the index a ranged type within int(0 to N-1) for a FixedArray with N. So is a spawn of a factory that throws: the spawner waits for the factory to run on the service’s start behaviour and receives the handle or the factory’s error.

‘otherwise’ is written without a ‘try’.

An ‘otherwise’ handler’s value has a type other than the ‘try’ expression’s type. It carries a SECOND message on the same fault seen from the value side: a try in a VALUE POSITION over a callee that returns nothing – 'f' does not return a value, anchored on the try. A BINDING is a value position too, so if let x = try voidF() (and if let _ =, which discards a result that does not exist) is refused here as well. NOT E3124, which is the opposite mismatch – a value produced and dropped. A THIRD message refuses a bare propagating try await h.m(x) whose handler throws: the await can fail at the send with <Service>.<message>.sendError and in the handler with its own error, and no one error type names both. Handle both with otherwise (e) and match e, or split it: let p = try h.m(x) propagates the send error, then try await p propagates the handler’s.

Two typealiases in scope declare the same name. A directory declares each top-level name once, so two typealias declarations of one name collide in one file or across the files of one DIRECTORY, whatever their tier: an unmarked alias claims its name in its directory too. Two library aliases of one name that a single reader could name both collide as well. Aliases in different directories are legal whatever their forms; an ambiguity between two an author could both name is a property of the USE – E3063 at the reference. A colliding pair involving a type/enum/union/interface, a top-level let or var, or a function is E3006 instead. The alias kept is the earlier one within a file, and across files the one in the file whose absolute path, with / separators, sorts first byte by byte; the other is reported at its name. Rename one declaration. A type has one member of each name, so two extension bodies declaring the same nested typealias for one type collide wherever they sit and whatever their modifiers or instances: the later one is reported at its name, and the message names the file of the one kept. Rename one member. A type or interface body declares each nested typealias once: a second declaration of the name in the same body is reported at its name, whatever its form. Rename one member. An extension of a type that declares a nested typealias the type’s own body declares would hide it, so the extension’s declaration is reported at its name, in any file and for a standard-library type too. An interface extension’s nested typealias is a default instead: a conforming type whose body declares the same member keeps its own. Rename the extension’s member.

A typealias is declared and never used. “Used” means the NAME appears in a type position in a file of the alias’s declaring directory or one of its subdirectories, and a spelling credits only the declaration it resolves to there, so a parent directory’s alias that a nested directory’s alias of the same name hides is unused. An exported alias is exempt, and being implicitly inferable from a bare [...] literal is not a use.

A bare type name reaches more than one author declaration this file may name – typealiases, types, enums, unions or interfaces in different directories – and none is nearer. A bare name means the reading file’s own directory’s declaration, else the project root’s, else the one declaration the file may name; it is ambiguous only where neither the reader’s directory nor the root declares it and more than one other directory does. It is refused at every position a type name can be written in, the element of a b"…" literal (the bare Byte) among them, and the message lists the qualified spellings that remove the ambiguity: dir.Name for a directory, export.Name for the project root. A standard-library or runtime declaration never takes part: a program’s own declaration of a library name is what the bare name means, and the library’s stays reachable as stdlib.Name. Qualify the reference. E3095 applies the same order to functions and bindings.

a pure-function call’s result was discarded. Pure callees must have their result used – neither bare foo() nor _ = foo() is permitted. Fires from checkDiscardedResults, whose other arm is E3065: one verdict, split on whether the callee had another reason to run. A lint rule: maxon lint, maxon spec-test, the MCP check tool and the language server report it, and maxon build, execute, run and test compile past it. The compiler raises it from FOUR statement doors – a bare foo() line, _ = foo(), a tuple assignment whose every target is _ ((_, _) = makePair(10, b: 32), specs/tuple-assign.md), and a discarded MATH INTRINSIC (round(10) as a statement) – which differ only in who answers the purity question. An intrinsic needs no summary: the roster is machine instructions, so the statement is provably dead. A DECLARED callee is judged by the whole-program effect summary, unless it is CHAINABLE (first parameter the receiver, return type the receiver’s own), which the language lets a caller drop freely. A container read the parser lowered straight to a runtime entry is judged by that entry’s read-only roster and reported under the member the author wrote (Array.first, never __managed_first). The bare-call door covers every CALL-STATEMENT spelling, not only foo(): a method (arr.count()), a field chain (b.ops.count()), a static member and a namespace-qualified free call all take none of what they produced. Each is anchored on the CALLED NAME – the last name of the chain the ( follows. A throwing pure call written without try inside a try block or a test body, whose handler takes its error, is discarded the same way and refused the same way. The summary CLOSES OVER a witness dispatch rather than reading it as an effect: a constrained requirement (key.hash() inside Map.get) has candidates, and they are every declared member wearing the requirement’s name whose body this program reached. A write to a record the callee created itself leaves it pure, so a builder that fills and returns its own array is pure. A call through a closure counts as the closure’s body when the closure is known where the call is made – a closure literal, or a named function, handed to a helper that only calls it; a closure the call cannot identify is an effect. Releasing a value that can own a green thread, a service handle or an operating-system handle (a promise, a file, a socket, a type parameter’s value) is an effect of the releasing function.

an impure-function call’s result was discarded without the explicit _ = opt-in. The impure-call result still has to flow into either a binding (let r = foo()) or an explicit discard (_ = foo()). Fires from checkDiscardedResults. A lint rule: maxon lint, maxon spec-test, the MCP check tool and the language server report it, and maxon build, execute, run and test compile past it. THE OTHER ARM OF E3064’s VERDICT: one pass asks the effect summary once and splits on the answer, so a callee is never both. What selects between them is the site’s DiscardDoor – E3065 fires at a BARE STATEMENT only, because _ = f() and (_, _) = f() ARE the opt-in the message asks for, and a try ... otherwise statement is an accepted discard of its own. The compiler reaches it only for a DECLARED callee. The summary answers “not provably effect-free” for everything it cannot see, and that answer is SILENCE under E3064 but a REFUSAL under E3065 – so a lowered runtime entry, whose read-only roster is a whitelist rather than a proof of effect, earns neither.

A ‘union’ value is compared with ‘==’/‘!=’. Unions carry no synthesized equality; use ‘match’. a union value was compared with == / !=. Unions carry no synthesized equality – a new case can’t be added without every match site being forced to handle it, so the only way to inspect a union is match. Enums (which auto-implement Equatable) are unaffected. The rule binds every tier: the standard library is refused the same way. Emitted from Parser.emitComparableCompare.

a textual self-assignment (x = x, p.x = p.x) or a discard-assignment whose RHS isn’t a function call (_ = 42). The former has no effect; the latter is the historic shape for opting out of a “discarded result” warning, but a non-call RHS makes the discard nonsensical. The two shapes are raised from two doors, because they are answerable at different moments. The SELF-ASSIGNMENT half is Parser.rejectDegenerateAssignment, purely textual: a place chain assigned to itself token for token, asked from parseStatement before the dispatch, when no op has been emitted. The DISCARD half is Parser.parseAssignment’s _ arm, which asks whether ANY op the statement emitted calls or suspends (Parser.statementCallsOrAwaits). So _ = 42, _ = c.name, _ = a + b and _ = round(1.5) are refused, while _ = f(), _ = (f()) and _ = try stack.pop() otherwise 0 are not. ANY op rather than the LAST op: a last-op rule cannot follow a value a DIVERGING try ... otherwise panic(...) fork laundered, and would refuse 54 statements of that shape (52 in maxon-bin/, 2 in stdlib/). _ = async f() and _ = await p ride the same widening: a spawn owns a green thread and an await consumes one, so both are effects, and async-promise-drop.md is about exactly that spelling. _ = someBinding, a BARE name resolving to a live binding, is ADMITTED: it is E3012’s only spelling for acknowledging a binding without using it – deleting it from a spawned-never-awaited promise reports “unused variable”, so refusing it would make E3012 and E3067 jointly unsatisfiable for one program. A void right-hand side never reaches the door at all: E2004: Function 'push' does not return a value is reported from the expression instead. That refusal is the EXPRESSION parser’s; no program in the tree writes the shape. x = (x) is admitted (parenthesized: different tokens); self.n = self.n and a.b.c = a.b.c are refused. The decision is made BEFORE name resolution and the mutability check, so an immutable or undeclared target reports this code rather than “cannot assign to immutable variable” or undefined-variable.

The ‘is’/‘is not’ reference-identity operator is applied to a value, which has no object identity. Identity has meaning only for a reference: a heap record is a pointer, and two names can share one. A primitive (int, float, bool, byte, …) is refused, and so is an inline packed record — a type whose fields are all let and pack into one machine word, so its value is that word. An enum case and an opaque type parameter are values with no object anywhere. A union box and a function value are one-word addresses, and are refused because the language defines no identity reading for them. An existential is a fat pointer, so a one-word compare would ignore its witness half. Widening the admitted set yields a pointer compare, never a type error, so a tag admitted without a defined reading is a wrong answer rather than a missing one. TypeRules.tagHasReferenceIdentity owns the tag half and Parser.valueMayBeAReference the layout half.

a statement appears in the same straight-line block body immediately after a return, throw, panic(...), break or continue. The trailing statement is unreachable – control never falls through a block-terminating statement – so it is dead code. Emitted by the parser’s statement-list loop when a terminator is not the last statement of its block. Control-flow that creates separate blocks (a return inside an if, with code after the if) does NOT trigger this: that following code is reachable on the else path. It is a CORRECTNESS rule and not only a lint: a block’s terminator lives in a slot setTerminator overwrites, so an accepted statement that terminates the block itself (an if, while, for, match) silently REPLACES the return/break already there. The rule covers break/continue as well as return/throw/panic, which specs/break.md pins.

a struct-literal names a compiler builtin managed type (__ManagedFile, __ManagedMemory, __ManagedDirectory, …). These carry an opaque runtime handle and must be obtained through their static factory methods (e.g. __ManagedFile.openRead), never built directly. Emitted by the parser at the struct-literal site.

an async f() call targets a function that never yields (contains no await / I/O stub call, transitively). async is only for I/O-concurrent work – a non-yielding callee would run to completion synchronously on the spawning thread, so the spawn is pointless. Emitted by checkAsyncYielding.

E3074 — semanticSubprocessUnsupportedTarget

Section titled “E3074 — semanticSubprocessUnsupportedTarget”

A user program targeting wasm32-wasi reaches the ‘Subprocess’ API (transitively calling a __gt_subp_ runtime entry). WASI has no process-spawn primitive, so subprocess cannot exist on that target – rather than silently throwing ‘spawnFailed’ at runtime, the call is rejected at compile time. Guard the call with #if not os(Wasi) to exclude it from the wasm build. Raised from SemanticCheck.requireTargetSupportsCallee, at the first call from USER code into a stdlib/Subprocess.maxon entry point, where E3104 would otherwise be raised. Reported once the program has no other error, beside any unneeded cast (E3010).

A match arm names a case in qualified form (Color.red). The scrutinee’s enum is already known at the arm, so the bare case name suffices.

a struct literal (Type{...}) is written outside the type’s own methods. Construction is restricted to the type’s own methods / static factories so invariants can be enforced at the single construction point; external callers must go through a static function create(...). Exempt: Self{...} and Type{...} inside Type’s own body, plus an inner alias of the body being parsed that names a container the compiler owns (Map’s KeyArray{}). An inner alias naming a user generic, and every top-level alias, keep E3076: use <Alias>.create(...). Emitted by parseStructLiteral.

A local declared with var is never reassigned, so it should be a let. E3012 (unused variable) takes precedence: a function with an unused variable reports only those. Decided at the declaring function’s end (Parser.reportVarShouldBeLet) off the candidate list E3012 walks, reading the per-function name set (mutabilityExercisedNames) the mutable doors record into, and REPORTED after every check ahead of code generation, only when none of them raised a diagnostic; it takes precedence over a code-generation error (E5001, E4015). A let writes through to the record it names, so the keyword says nothing about the data behind the name: a var is kept only by what reassigns the name itself, which is an assignment, passing it to a mutable parameter, and calling a mutable self method on a value of a value type (text.append("!") over a String). A field store, a push, a call whose callee writes the parameter and a move out of the name leave the var unreassigned, so each is reported, whatever the initializer: a fresh record, a read-only value or state something else may write (var node = holder.box). A var bound to an array, map or tuple literal that is written through is reported with the fix let x = [..].clone(), because a plain let of a literal is constant data and refuses the write (E3207). In library source (stdlib/, a scriptlib/ package) it is reported only in a function the program reaches, because only there is that let judged.

A match arm binds a case’s payload values and then never reads them. Drop the bindings, or use them.

a labeled control-flow block (if/else/while/for) has no statements between its header and matching end. Refused so dead control-flow can’t sneak past a refactor; emitted from parseBlockBody when the token after the header is the block’s end.

a block-form try 'label' ... end body contains no throwing calls (no bare throwing call/methodCall, no routed throw). The construct exists to funnel multiple throwing calls into one handler; a body that can never fail has no error to route, so the otherwise handler is dead.

the otherwise (e) 'label' ... end handler of a block-form try must contain a match on the error binding e. Without it, the synthesized (possibly union) error value is never inspected and the handler cannot dispatch on which error occurred.

a bare case-name pattern in a match on a synthesized error union is shared by two or more union members, so it is ambiguous – the user must qualify it as EnumName.case.

a struct literal omits a field that has no default value, is not a compiler-synthesized managed builtin, and (for a return-site Self{...} in a static factory) was not proven definitely assigned via self.field = expr on every control-flow path to the literal. Emitted from the parser’s struct-literal field-init checks and the post-body definite-assignment dataflow pass.

an if x.contains(k) whose then-block immediately performs try x.get(k) otherwise ... on the same receiver/key pair does the lookup twice. The compiler asks the user to rewrite as if let v = try x.get(k) ... 'lbl' (or if var) so a single lookup serves both the membership test and the value bind.

A typealias refers back to itself, through a chain of aliases or of implements clauses.

An ‘export’ symbol is never referenced outside its declaring directory. Drop the modifier, or say ‘public’ if it is API surface. A lint rule: maxon lint, maxon spec-test and the MCP check tool report it, and maxon build, execute, run and test compile past it. an export (global) decl is never referenced from any file outside its declaring directory’s subtree, where an unmarked declaration already reaches every reader it has. The root directory is no exception: an export in a root file that only root files and their subdirectories read is reported. Applies to functions, types, enums, typealiases, top-level constants, and exported struct fields. Emitted by checkUnusedExports after all files have been parsed and type-resolved. A public declaration is EXEMPT. export says “other files may see this, and I expect this program to use it”; public says “this is API surface”, so “no caller in this compilation” is not a finding about it. That distinction is what makes this diagnostic answerable at all: see Visibility in maxon-bin/Compiler/Project.maxon. A one-file program is audited like any other. The entry point and every target or task a .maxproj or .maxtasks file declares are exempt: nothing in the source calls them, because the runtime, maxon build or maxon run enters them by name. A type an E3167 surface names – a signature, a binding, a field, a payload, a typealias’s target or a clause – is credited at that surface’s tier while its declaration is itself referenced from outside the type’s declaring directory, or while the type owning the surface is credited at that tier, because dropping the modifier would then earn E3167. So “drop the modifier” is not the remedy for such a type: drop the demanding surface’s modifier, or raise the type. Every typealias form is audited – ranged, function, generic-instance and tuple – and a use credits exactly the declaration it means, so a name two files declare is two audits. A use reached only through a called function’s signature counts. So does a name spelled in a body the compiler did not build: a generic function nothing instantiates, the branch of a #if the target excludes, a standard library body no program path reaches.

A bare function or top-level binding name has more than one reachable definition; qualify it as ‘dir.name’. A bare name means the nearest declaration: the reading file’s own directory’s, else the project root’s, else the one declaration the file may name. Two or more directories declare a free function or a let or var of the name and this file may name more than one of those declarations, none in its own directory or the root, so none is nearer. It is refused at each door a bare function name is written at — a call, a function value (let f = helper) and a function-backed enum case (op = helper) — and each accepts the directory-qualified form (beta.helper) as the remedy. A call is refused in every form it takes: as a statement or with its result used, under try or if let … = try, spawned with async, awaited or stored, and in a top-level or static initializer. An enum case refused here is reported once, in the file that declares the enum, whichever file calls through it. Decided by ProgramSignatures.resolveFunctionName; a call is reported by SemanticCheck, the other two doors by the parser.

==/!= against an enum/union value’s .name, .ordinal, or .rawValue accessor. Such a comparison is checking which case a value is, which must be done on the value itself (value == Type.case for a payload-free case, or match value for a union variant – so adding a case forces every site to handle it instead of silently slipping through). Comparing the derived string/int accessor bypasses that.

A promise is stored in a slot – a container, field, tuple, union payload or array literal – or handed to a parameter or a generic container’s method, whose Promise type is not the promise’s own. A slot takes any promise the storing function owns (an async spawn, a service reply, a parameter, the return of a call, one moved out of storage) provided the types agree, and the message names what differs.

Promise is parameterised by BOTH what its thunk returns and what its thunk throws: Promise with T is a NON-throwing promise, Promise with (T, E) one that throws E. Two promise types are one type only when both agree, so the refusal is one of:

  • the result type differs, and await would hand back a value under a type the thunk never returned;
  • the error type differs: the slot drops it, which ERASES it, names another enum, or names one the promise does not throw.

Erasing the error is the root of a family of bugs, all of which this refusal turns into impossibilities:

  • otherwise (e) has no type to give e, and silently hands back the raw i64 promise handle typed int;
  • an associated-value error’s payload has no static type to mm_decref, so it LEAKS;
  • propagation (a bare try await p inside a throws function) has no error type to check the enclosing function’s throws against, so a thunk throwing A can be awaited inside a function throwing B and A’s ordinals reinterpreted as B’s tags. A service reply kept with let p = try h.m(x) is a promise of the handler’s own error alone – the send’s error is the try’s – so it is stored as Promise with (T, E) when the message throws E, and as Promise with T when it throws nothing.

A promise is awaited a SECOND time. await is LINEAR: a promise is awaited exactly once. The thunk owns its result and HANDS IT OVER at the await – that is the ownership model the language already has everywhere else. A second await would take a second +1 on a payload the thunk only ever owned once, and the two releases underflow the refcount and free it twice (“mm_decref: refcount underflow (already zero)”). It is not an error-handling bug and does not need a throwing thunk: a plain async returning a String double-frees identically. So the double-free is made UNREPRESENTABLE rather than fixed. The check is flow-sensitive – two awaits of the same promise in mutually exclusive branches are each the only await on their own path, and are allowed; what is refused is a second await REACHABLE from a first.

A throws function is referenced as a VALUE (let f = risky). A function type cannot express throws – the grammar is function(T) returns U, with no throws clause – so the binding silently drops it, and there is no indirect try-call to carry it: StdIndirectCallOp has no ErrorFlag, unlike StdTryCallOp. Before this check the call was not merely unchecked, it was WRONG. The callee took the error return (ordinal in RDX, xor rax, rax in RAX); the indirect caller read RAX and ignored RDX, so the throw vanished and the caller received 0 – the dummy – as a normal result. try was bypassed entirely by round-tripping the function through a value. Refused rather than supported, on evidence: no spec and no stdlib file ever wanted a throwing function value. Adding throws to the function-type grammar plus an indirect try-call ABI is a FEATURE, and would be built for nobody. If a real need appears, that is the shape – and this code is what says so.

A binding is READ after its owned heap value was MOVED OUT of it. Under the compiler’s static single-owner model an owned value (an owned String, a struct box) has exactly one owner; a let u = t / s = t whose RHS is a bare var TRANSFERS ownership to the destination; the source is left moved-from. A let or var the sender owns, handed to a service message or to a spawn, moves the same way, a binding a closure captures moves into the closure, a let or var handed to a parameter that keeps a unique value moves into the callee, a unique OS handle (TcpClient, TlsStream, StreamingSubprocess, …) moves when it is bound by let, pushed into a container or handed to a spawn, and one binding handed twice to one message is moved by the first. A later read of the source is refused – it would read a value another owner now holds and will drop, and dropping it twice is a double-free. A value moved inside a loop is refused at its read on the next trip. A WRITE to a moved-from var is legal (it revives the binding). Read a .clone() instead, or move the value only after its last read. A PROMISE moves the same way and is refused here too: storing one into a container slot, a struct field or a union case, or passing it to a call by value, gives its green thread to that new owner, and a later use of the name it was stored from would name a thread this frame no longer holds. Awaiting or cancelling a promise is not a move but a consume, and is E3142. One promise, or one value of an opaque type parameter, passed at two arguments of one call whose parameters take it is refused at the second argument, naming the binding written there: the first argument already moved it. Pass it at one argument. The variable a match arm lends a unique payload from is refused to a callee that writes through it, in a call that also names a binding of the arm: the binding views the matched value, and a unique value has one name. The receiver, a call through a function value and a call through an interface method are judged the same way. Write through the variable in a statement that names no binding of the arm.

A / or mod has a divisor the compiler holds as the constant 0 (a / 0, a mod 0, a divisor that folded to 0, or the float a / 0.0 and a / -0.0 – both of which give an infinity). Unlike a possibly-zero divisor – which is a throwing operation handled with try (E3057) – a provably-zero one is neither recoverable nor safe: it is a bug, rejected at compile time.

A construct is reached by a program compiled for a target whose backend has not lowered the runtime entry it needs. Which host facility each entry needs and which targets provide it are the two halves of TargetFacilities; wasm32-wasi is the lane that still lacks facilities, so sleep, __Builtins.runProcess, the streaming-subprocess builtins, the __Builtins clock intrinsics and the file/socket/argv/stdin surfaces are all refused there. The call is refused at ITS SOURCE SPAN, naming the runtime entry that has no lowering. Distinct from E3074, the subprocess-specific WASI rejection: that one says subprocess can NEVER exist on wasm32-wasi – a permanent property of the platform – while this one says the target has not lowered the entry, a statement about this compiler’s progress. Reported once the program has no other error, beside any unneeded cast (E3010).

E3106 — semanticArrayResizeManagedElement

Section titled “E3106 — semanticArrayResizeManagedElement”

Array.resize is called on an array whose ELEMENT TYPE IS MANAGED – a struct, a String, a nested container, a boxed union – or is a Promise. Such an element lives in the buffer as a POINTER (a refcounted one, or for a promise one into the scheduler’s slab), so the zeroed slots resize exposes are NULL: an absence, not a value. Maxon has no default constructor, so there is nothing correct to put there, and the array it hands back is one whose count() does not agree with its get() – count() says N while get(0) throws. Refused at the call site, naming the element type. The same call is refused for an inline element that has no zero value: a ranged alias whose range excludes zero (int(1 to 100)), or a payload-free enum or union whose raw values (tags) include no 0. The grown slots hold zero, which is not a value of the element; for an enum or union it names no case, so a match over the element would not be exhaustive. So are the other producers of slots nothing wrote, over such an element: __ManagedMemory.setLength and FixedArray.create. Array.create(n) and create(n, zeroed: true) over such an element are refused the same way, because they publish n zeroed slots. create(0) is legal for every element, and create(n, zeroed: false) reserves room for n elements and publishes none; append with push(value), or fill with growFilled(newLength, value:) naming a case. An enum or union that gains a case whose raw value is 0 admits the zeroed forms. A FixedArray created with value: (Buf.create(n, value: v), Vec3.create(value: v)) publishes v in every slot, so it is legal for such an element and for a managed one, which a plain FixedArray.create refuses too. In a generic body the element is a type parameter and one body serves every instantiation, so the instantiations decide: create(n) over the parameter and a FixedArray with N <type parameter>’s create() are refused when any instantiation of the type is at such an element or a managed one, and so is resize in a body you wrote, because that one call zeroes the slots for every instantiation. The refusal covers the WHOLE call and not only its growing half, because which half a resize(n) is cannot be known until it runs: n is compared against a length, and a compiler holds neither. The two halves therefore split by NAME. Growing supplies the element the type cannot invent – push(value) appends one, growFilled(newLength, value:) grows to a length in one call – and shrinking needs no element at all, so truncate(newLength) stays available for every element type. All three are stdlib/Array.maxon’s, and BOTH compilers compile that file – The compiler loads all of stdlib/ – so the cures are the same on both. the compiler’s message text still names only push, which understates the other two. A standard library body’s resize over an unbound type parameter is not refused: the deliberately sparse slot tables in stdlib/Map.maxon and stdlib/Set.maxon are built exactly that way – they track occupancy in a parallel states column and never read a slot they did not write. The layer where an unwritten slot is a defined state is __ManagedMemory.setLength, and it stays available for every element that admits zero.

Two test declarations in one file carry names that SANITIZE to the same symbol. A test has two names – the prose one the reporter prints, and the mangled __test_<sanitized> one that reaches the symbol table – and the sanitizer maps every character outside [A-Za-z0-9_] to _, so adds two and adds-two collide even though they read differently. The message names BOTH prose names and the symbol they share, because the collision is invisible in either name alone. Refusing it is independently worth doing: two tests with the same DISPLAY name are unreportable – a reader of the report cannot tell which one failed – so this rejects the identical-prose case for its own reason, not merely as a symbol-table accident.

The BUFFER surface’s set (arr.managed.set(index, value:)) is called on an array whose ELEMENT TYPE IS MANAGED – a struct, a String, a nested container, a boxed union. That setter is bounded by CAPACITY rather than by length (a 2026-07-30 user ruling), so it can write into [length, capacity) – slots no length has published yet. For a TRIVIAL element that is the whole point: it is the stage-then-setLength-to-publish idiom the buffer surface exists to support. For a MANAGED element it opens a hole, because that region carries no OWNERSHIP: __managed_decref destroys only [0, length), push/insert/append store AT length without destroying the occupant, and a grow or a copy-on-write detach copies only the live bytes and abandons the rest. A staged element is therefore owned by NOBODY until a setLength publishes it, and is leaked outright if one never comes. Refused rather than fixed, and the choice is deliberate. Making ownership follow the staged slot would put a destructor gate on every managed push – a hot path – and would make the [length, capacity)-reads-ZERO invariant conditional, which five separate array operations currently rely on. Refusing costs none of that, and costs no capability: [0, length) is exactly what the ARRAY surface’s own set(index, value:) covers, which is length-bounded, owns what it stores, and is unaffected. So the message names it. Refused at the call site, naming the element type, and only where that type is KNOWN. It needs no carve-out for an unbound type parameter: .managed is unreachable through a shared generic body at all (a field access through it is refused one step earlier), so every site this rule can see has a concrete element.

E3110 — semanticBufferByteAccessManagedElement

Section titled “E3110 — semanticBufferByteAccessManagedElement”

The BUFFER surface’s RAW BYTE access – arr.managed.setByte(offset, value:) or arr.managed.byteAt(offset) – is used on an array whose ELEMENT TYPE IS MANAGED: a struct, a String, a nested container, a boxed union. A managed element does not live in the buffer as DATA. It lives there as a POINTER to a heap allocation, so the bytes those two members address are the bytes of an ADDRESS. Reading one hands a fragment of a heap address back to the program as though it were a value – a silent wrong answer, and an information disclosure. Writing one corrupts the pointer in place, and the element it named is then unreachable and unreleasable. This is NOT the reason E3109 refuses managed.set, and the two must not be collapsed. That one is about OWNERSHIP of a staged element and applies only past the published length, so it has a harmless half and an exact replacement. This one is about the element’s REPRESENTATION, so it holds at EVERY offset, published or staged, and there is no bound that would rescue it and no other spelling that does the same thing. Byte access to a managed element is not a thing a correct program wants. byteAt is refused alongside setByte rather than after it. It returns a value, so it corrupts nothing and trips no leak gate – it is precisely the half that stays green forever if only the writer is fixed. TRIVIAL elements are untouched, which is the whole point of the rule being about the element type: __ManagedMemory.create can only ever yield a trivial element, so the byte-level staging the buffer surface exists for – string building, a NUL terminator written at the length boundary – is unaffected.

A user program declares a type name that a stdlib module ALSO declares, and that same spelling is used by stdlib source, or by a scriptlib package the program loads, as a MEMBER name – a field, a method, or an argument label. The shadowing rule moves the stdlib TYPE declaration into the reserved __ space so both declarations can coexist, and that rename is applied uniformly to the stdlib and scriptlib files’ identifier tokens, which is what makes it reach every spelling of the type at once. A member is the one spelling that is also reachable from USER code, whose tokens are never rewritten, so the two sides would disagree about one name and the member would silently stop resolving. Refused rather than risked; rename the type in the user program.

A function’s throws clause names something that is not a declared enum or union. The error-flag ABI carries a caught error as ordinal + ErrorFlagOrdinalBias for a payload-free enum and as a heap BOX POINTER for a payload-carrying union, and which of the two it is comes off the DECLARED clause at the catch site while the throw site derives it from the value it actually throws. A clause naming anything with no declared cases – an INTERFACE (throws Error), a struct, or a name that resolves to nothing at all – leaves those two derivations free to disagree: throws Error throwing a payload-carrying union decodes as an ordinal and the box is never released – exit 101, a leak, in BOTH compilers. It is a rule about a FUNCTION’s own clause, not about an interface REQUIREMENT’s: a requirement whose throws names an interface is the abstract error channel Error exists for, is dispatched through the witness ABI, and is guarded separately by E3016.

E3114 — semanticAmbiguousWitnessDispatch

Section titled “E3114 — semanticAmbiguousWitnessDispatch”

A method call on a constrained type parameter names something that MORE THAN ONE of the requirements its where constraints supply could be. An interface and its extends parents may each declare the name, and two constraints on one parameter may each declare it too – and those are DISTINCT requirements occupying DISTINCT witness-table slots, so “they are both called label and both take one argument” does not make them interchangeable: two same-named, same-arity requirements may differ in RESULT type, and are then met by two different members and two different addresses. DISTINCT means declared by two different interfaces. One requirement reached through two constraints – where T is Left and Right where both extends Root – is NOT this code: the accepted member is filed under (conformer, DECLARING interface, method name), so both routes stamp their slot from one filing and bind one address. Counting those two routes as two claimants would be a false reject whose message names a requirement as its own rival. A witness dispatch compiles ONE slot offset into the calling function, so there is nothing to choose by and nothing a later pass could repair. Taking the first candidate is a silent wrong function pointer rather than a diagnostic – which is why the ambiguity is refused rather than resolved by declaration order. The message names BOTH claimants by their DECLARING interface, since that is the interface the author has to change; the cure is to rename one requirement or to drop one constraint.

E3115 — semanticNoWitnessRequirementForArgCount

Section titled “E3115 — semanticNoWitnessRequirementForArgCount”

A method call on a constrained type parameter names a method that the parameter’s where constraints supply SEVERAL requirements for, and the call’s argument count matches none of them. It is E3036’s case (an arity mismatch) at a call site where E3036 cannot be written: that code names ONE callee and ONE expected count, and here there are several, none of which is the one the author meant. Blaming an arbitrary candidate would print a true sentence about the wrong requirement – the exact failure interface Derived extends Base produced before the requirement list became transitive, when Derived.label was reported to expect one argument on a call to an inherited zero-argument label(). With exactly ONE requirement of the name there is nothing to select between and the arity is reported by E3036 as it always was, so this code is reached only where a choice genuinely existed.

E3116 — semanticStaticRequirementNotDispatchable

Section titled “E3116 — semanticStaticRequirementNotDispatchable”

A call reaches a requirement its where constraints declare static through a constrained type parameter: as a method call on a VALUE of that parameter, or through the parameter itself, T.make(), written as an expression or as a statement. A static member has no receiver, so there is nothing for the call to dispatch on; a static member is called on a concrete type, which is exactly what a where constraint does not name. Neither neighbouring message could carry it. E3036 states an argument COUNT, which is what the same call shape gets on a CONCRETE receiver and is about the wrong thing; E2015’s “no where constraint declares a method” would be FALSE, since the constraint declares it and only its receiver kind is wrong. The OPERATOR form of the same hole takes E3005 instead, and deliberately: there the question is “is this requirement the Equatable/Comparable protocol?”, a static one is not, and the author’s cure is the sentence E3005 already prints for a throwing or wrong-arity look-alike.

A construct that fills an Array with Byte with RAW BYTES, one byte per ELEMENT, is written in a file whose Byte does not admit every byte value 0 through 255. Two constructs reach it, and both write bytes that exist only at RUN TIME: the byte view (String.toByteArray() / .bytes(), whose runtime fill blits the receiver’s UTF-8) and __ManagedFile.read, which blits a file’s contents into a caller’s buffer. A raw byte is any of 256 values. An element declared int(0 to 100) promises every value of every Array with Byte in the program is at most 100, and a raw fill breaks that promise with no place to put a check: the fill is one runtime blit, not a run of stores the compiler can narrow one at a time. MEASURED without the rule: takes("ss".toByteArray()) into takes(b Array with Byte) returns 195 out of an accessor declared int(0 to 100). Silent. The buffer surface’s setByte is NOT this code: it addresses a byte OFFSET rather than an element and therefore asks E3118’s slot question at every stride. “Admits every byte” is that question’s ONE-BYTE instance and nothing more general, which is why the two are separate codes rather than one widened rule – see E3118. It is a PER-TYPE rule and its PER-VALUE sibling is E3005, which is why the two are separate rules rather than one. E3005 checks each byte of a b"..." blob against the same bounds and must keep accepting b"abc" under int(0 to 100); there is nothing here to inspect, so the only honest question is about the element. Retyping the byte view onto the compiler’s own __ManagedByte element instead was the obvious cure and is WRONG: emitArrayCreateOp stamps the view’s element_size@24 from the very instance it is typed as, so a wide Byte gives a genuinely stride-2 record the runtime fills at that stride (MEASURED correct). A stride-1 __ManagedByte view would then be refused by byteBufferBoundaryAdmits’s stride test at every declared byte-array position, turning a program that answers correctly today into a compile error. The raw byte READER is deliberately untouched. byteAt yields a plain unranged int, never the element, so a byte read back is honest whatever Byte was declared to be. Unlike E3110’s pair, only the write puts a value into a slot the array surface reads through the element’s range. Neither of the two remaining sites needs a STRIDE precondition, and that is what makes them the right two for this question: the byte view’s fill is element-wise at whatever stride the element declares, and __ManagedFile.read’s argument gate has already established that its buffer is byte-packed. A rule that grew a stride test here would stop asking on exactly the element it least trusts – a Byte whose bounds cannot be read takes the MACHINE WORD (rangedAliasStorageBytes), so the byte view would stop looking byte-packed and slip the rule.

The buffer surface’s raw-byte writer (arr.managed.setByte(offset, value)) is written on an array whose ELEMENT does not admit every bit pattern of its own storage SLOT. setByte addresses a byte OFFSET, so on a record that strides more than one byte it writes a FRAGMENT of an element – and what the ARRAY surface reads back afterwards is an arbitrary unsigned value of the element’s whole slot, because the load of an unsigned slot zero-extends (ManagedMemoryRuntime.emitStrideSlotLoad). The only honest question is therefore whether the element admits every one of those, and it is the SAME question at every stride. MEASURED with no such rule, each a value read back through an accessor whose declared type cannot hold it: setByte(1, 223) under typealias Wide = int(0 to 1000) – a TWO-byte slot – read back 57089; setByte(0, 223) under int(-5 to 5), which keeps the machine word because rangedAliasStorageBytes is the unsigned ladder, read back 223; setByte(0, 223) on a bool element made a value for which both it and its negation were true while v == true was false; and on an ENUM element – a tag in the narrowest slot its raw values need, one byte for a two-case enum since enum-narrow-storage – the program compiled and then HUNG, matching an ordinal no arm names. It is deliberately NOT a widening of E3117. That code asks whether the element admits every BYTE, which is this question’s answer at a ONE-byte slot and at no other width: asked at a wider slot it refuses a correct Array with Int, and asked here at a one-byte slot it would give the identical verdict this code already gives. So setByte is governed wholly by this rule and E3117 covers the two fills that are byte-per-element by contract. Its one-byte arm ASKS rangeHoldsEveryByte rather than re-spelling it, so what a byte is stays written down once. The ADMITTING direction must be a proof, which is why an element with no value set the compiler can compare – a bool, an ExitCode, an enum’s ordinal, a float alias, an opaque T, a function pointer – is refused rather than guessed at. That is rangeHoldsEveryByte’s own conservative argument, one quantifier out. ExitCode looked like the closest call and is not: it reaches an Array instance as a NAMED leaf, so undeclaredNamedElementSlot gives it the MACHINE WORD, and a domain of at widest 0 to u32.max (PLATFORM-DEPENDENT below that – 0 to 255 on Linux, macOS and WASI) cannot cover an eight-byte slot on any reading. The measured 3741319169 is 223 at byte 3 of that word. The one element with NO value set that is still admitted is the Byte a b"..." literal mints for itself in a program declaring no such alias: its slot is one byte by construction (undeclaredNamedElementSlot) and there is no declared range for a raw byte to fall outside of, which is exactly the case E3117 returns on. byteAt is untouched for E3117’s reason: it yields a plain unranged int, never the element.

Two conformers of one interface bind an associated type to DIFFERENT TYPES, and that associated type is written as a PARAMETER or RETURN type of a requirement the program actually DISPATCHES. Under dictionary passing an interface’s method bodies are compiled ONCE for every conformer, with no per-conformer specialization. So the shared body is compiled against exactly one of those bindings, and every other conformer’s impl is handed bits it reads as something else. On one call site reached with both conformers:

  • with float beside with Integer – x64-windows compiled clean and answered 1 where the program computes 51, the float conformer’s argument read out of the wrong register file, while wasm32-wasi trapped indirect call type mismatch;
  • with String beside with Integer – x64-windows SEGFAULTED (exit 139) and wasm silently answered 20, the int actual read as a String pointer;
  • with Integer beside with Score = int(0 to 100), actual 5000 – one conformer answered 5000 and the other RANGE-PANICKED at run time. It is refused on EVERY target for that reason: the register targets are the half that fails quietly. ⚠ THE RULE COMPARES THE BOUND TYPE, NOT ITS ABI CLASS. The last two cases above are both the SAME ABI class – a String and an int are both machine words, two ranged aliases are both machine words – and both are wrong answers. A dispatched requirement’s associated type has exactly one legal binding across the program. It fires only where the associated type REACHES a call, and only where a call is actually made. A program whose every call is statically resolved has no shared body and no witness table to be wrong about, so two conformers of different classes with every call direct are not refused. The compiler is whole-program, so which slots are dispatched is read off the emitted ops. ⚠ THE UNIT IS THE DISPATCHED SLOT, NOT THE DISPATCHED INTERFACE NAME. Both readers of the binding are keyed on the op’s own (interfaceDeclIndex, methodIndex) pair: LowerMaxonToStd.witnessFormalType resolves the FORMALS of the requirement a witnessCall names, and the parser types that same requirement’s RESULT. A slot no call jumps through has neither, so it constrains nothing: interface Tally { take(e Element) returns Integer; label() returns Integer } with two conformers binding Element differently and label() as the program’s only dispatch compiles. The message names each binding as the source spells it.

E3120 — associatedTypeReturnNotMachineWord

Section titled “E3120 — associatedTypeReturnNotMachineWord”

An associated type reaches the calling convention of a requirement the program DISPATCHES, and its conformers bind it to something a witness call cannot carry there. TWO clauses, and they fail in different POSITIONS:

  • a FAT POINTER – an interface-typed binding – anywhere at all, PARAMETER or return, because a witness call carries one machine word per argument and one per result, so the second word of the (value, witness) pair is dropped and the impl reads a witness that was never passed – a crash on a native target and a trap on wasm.
  • anything that is not an UNMANAGED MACHINE WORD in the RETURN position specifically. The rest of this entry is that second clause. A dispatch’s ARGUMENT types are settled where the call is emitted, so an associated PARAMETER is fine: the lowering resolves the binding and coerces the actual to it. A RESULT is not. Its type flows on into the program – which instruction m.make() + 11 picks, and whether the returned value is OWNED and released – and that is decided by the PARSER, from the requirement, whose return is the associated type and not what a conformer bound it to. There is no whole-program conformance registry mid-parse (project.conformances is filled at merge, after every file has parsed), so the front end has nothing to ask.
  • A float, or a typealias of float such as typealias Real = float(f64.min to f64.max), is not a machine word: the impl returns it in a float register and the call site reads the integer one, so a native target computes a wrong answer and wasm traps.
  • A String, a struct or a generic instance such as Box with Integer IS a machine word but a MANAGED one: nothing takes ownership of the returned value and nothing releases it, so the program leaks.

Admitted: int, a ranged integer typealias and a payload-free enum. Any binding compiles through a receiver declared at <Interface> with <binding>, which settles the result type at the site, and as an associated type taken only as a PARAMETER.

A float value is passed where an INTERFACE type is declared, so it would have to be boxed into an existential’s fat pointer. That pointer’s value half is a general-purpose MACHINE WORD – it is what a dispatch hands the impl as its receiver, and every conformer’s self is read out of an integer register. A float lives in a floating-point register, so widening one means a cross-register-file move that no TargetOp performs: a move’s two ends are colored into one file by construction, and the two converts and the movqGprXmm bitcast are each their own op. MEASURED before the rule: use(c Comparable, other Comparable) called with 2.5 compiled all the way to the x64 emitter and PANICKED there – a register-to-register move from xmm0 to rcx crosses register files – with no source position and no way for the author to see what in the program caused it. It is the same fact E2062 states for a type ARGUMENT (a type parameter is an opaque 8-byte general-purpose slot under the compiler's dictionary-passing, and a float value travels in a floating-point register, so it has no way through), one widening position over: dictionary passing gives a type parameter and an existential the same opaque slot, so it gives them the same limit. Closing it needs the value half to carry a float’s bit pattern – a bitcast at the widening and at every use – which is a representation change and not a check.

if try f() was written on a call that PRODUCES a value. The bare form is a THROW test, not a value test – the then branch runs whenever the call did not throw – so the result it produces is silently dropped and the form reads as though it were being tested. if try json.getBool(node, key: "enabled") reads as “if enabled” and means “if the key exists and is a bool”, which is true when the value is false. MEASURED without this check: a throwing answer(succeed bool) returns bool whose SUCCESS path returns false still takes the branch. ONE law, not a type-keyed one: if the call produces a value you must say what happens to it, so if try is legal only when the callee returns nothing – “run this, branch on whether it worked”. An IMPURE callee’s result may be discarded explicitly, if let _ = try f(). A PURE one’s may not: _ is E3064 there as everywhere, because a pure call whose result nobody wants is the wrong call. NOT E3055, which refuses a try whose callee cannot throw at all – a different fault with a different cure, and this one fires only once that question has already been answered.

E3125 — interfaceInstantiationBindingDisagreement

Section titled “E3125 — interfaceInstantiationBindingDisagreement”

A use site wrote I with <Args> – the existential I, held with its associated types bound – and one of those arguments is not what the program’s conformers bind that associated type to. An interface this program DISPATCHES through has exactly ONE binding per associated type, which is E3119’s rule and is forced by dictionary-passing: the shared body is compiled once, against one type, and every other conformer reinterprets those bits. Producing an existential IS such a dispatch. So the binding is a function of the interface NAME and the conformances are where the program states it – a use site does not CHOOSE one, it restates the one already settled. Refused rather than ignored: The compiler does not carry the arguments on the existential (there is one answer, in the conformances, and a copy on the type would be a second), so an unchecked claim would have no effect at all and would read as though it did.

E3126 — heldAssociatedTypeBindingNotConforming

Section titled “E3126 — heldAssociatedTypeBindingNotConforming”

A use site wrote I with <Args> naming an INTERFACE for one of the associated types, which HOLDS that position at that interface – every value of it is a two-word (value, witness) widened from whatever each conformer bound the position to – and one conformer’s binding does not implement it. The witness half is loaded from a slot of the conformer’s own table holding the nested table __witness_<binding>.<heldAt>, and a binding that does not conform mints no such table, so the slot would name a symbol nothing emits. It is the held position’s twin of E3017: a where constraint checks a TYPE ARGUMENT against the interface a generic demands, and a holding checks every CONFORMER’S BINDING against the interface the program means to hold the position at. Both are “this type must implement that interface”; they differ in which party supplies the type, so they are two codes rather than one.

E3127 — existentialWideningBindingDisagreement

Section titled “E3127 — existentialWideningBindingDisagreement”

A concrete value is WIDENED into a parameterized existential – I with <Args> – whose argument at some associated position is not what that value’s own conformance binds the position to. It is E3125’s rule moved to the one place it can still be asked once a use site is allowed to CHOOSE. E3125 compares a written argument against the single binding the conformances settled, and that comparison is exactly right while the argument is CONCRETE. It is wrong when the argument is the enclosing generic’s own TYPE PARAMETER: typealias TakerOfT = Taker with T inside type Box uses T says nothing about the program and something about each INSTANTIATION, so comparing T against Integer refused a correct program. Such a claim is therefore DEFERRED by E3125 – and a deferral owes a discharge, which is this code. The discharge is at the WIDENING because that is where a concrete conformer and a site’s claim first meet – a call argument, a return, and a store into an interface-typed field. The arguments ride the signature (FuncSignature.paramExistentialSites / returnExistentialSites) or the field’s declared spelling (ProgramSignatures.fieldExistentialSites), are substituted through the call’s own generic instance or the stored-into record’s, and the site’s argument at each position is compared – RAW, for E3125’s measured reason – against what THIS conformer binds there (declBindingEntry). Without it the deferral is E3119’s own recorded hazard one indirection later: a dispatch through the widened value is emitted against the type the SITE claims and lands in an impl written for the type the CONFORMER bound. E3119’s header records what that costs – with String beside with Integer SEGFAULTED (exit 139), with float answered 31 where the program computes 51, and a ranged binding RANGE-PANICKED – and none of those three is visible to E3119 here, because a program can reach this with exactly ONE conformer and no whole-program disagreement at all. ⚠ AN UNRESOLVABLE CLAIM IS REFUSED, NOT ADMITTED. A return, and a field store into Self{…} or self, are checked once against the shared body’s DECLARATION view, where the enclosing generic’s parameter is still opaque and there is no instance to substitute it through. There is no answer to give, so the same code refuses and names the position that CAN be resolved – the same cure E3120 offers for the same reason one door over. A value already held at the bare interface is refused at a claim of that kind too, because it does not say which conformer is inside it.

E3128 — semanticSharedConformanceReadsDictionary

Section titled “E3128 — semanticSharedConformanceReadsDictionary”

A method that satisfies an interface requirement for a GENERIC conforming type reads one of the hidden dictionary parameters its declaration reserves – its type parameter’s layout descriptor (sizeof(T), an opaque Array build, a borrowed T returned or stored), or the witness table of a where constraint it dispatches through. A generic conformer whose impls need no dictionary shares ONE witness table across every instantiation: every instance reduces to the one conformer name (ProgramSignatures.conformerNameOfType) and dispatches through __witness_<Conformer>.<Interface>. One compiled impl and one table serve every instantiation only while the impls are INDEPENDENT of the type argument. A dispatch through such a table therefore has no instantiation to take a dictionary from: the caller holds a table address and a slot index, and the two conformers sharing the slot disagree about what the dictionary would even say. The adapter that adjusts the impl’s arity for the slot (LowerMaxonToStd.appendWitnessAdapterDictionary) therefore passes a NULL dictionary, and this check is what makes that sound instead of a wild jump through a null table. Without the adapter the same parameters read whatever the ABI registers happen to hold – the identical unsoundness with no check, silent on x64 and a wasm trap: indirect call type mismatch on wasm. THE CURE IS A PER-INSTANCE WITNESS TABLE, AND THE COMPILER EMITS ONE. Where a table is minted for a CONCRETE instance of a conformer whose impls carry a dictionary, it is keyed by that instance (__witness_Box_Leaf.Sized) and its slots point at adapters holding the instance’s own descriptor, element count and constraint witnesses; a conformer whose impls need none keeps the one shared table. What this code refuses is the residue: a table demanded where there is NO concrete instance to key it by – a conformer with no instantiation in hand at all. THE PARAMETRIC ARGUMENT DOES NOT REACH IT. stdlib/Array.maxon’s ArrayIterator with Element, built by Array.withIterator() inside a body still generic in Element, would arrive here because witnessTableInstanceFor reduces a non-concrete instance to the shared table and the shared table’s adapter then hands the impl a null dictionary – the right refusal about the TABLE, asked one mechanism away from the call the author wrote, since the question a witness ARGUMENT poses is whether the CALLEE reads it. LowerMaxonToStd.parametricWitnessArg loads such an argument’s table from the calling frame’s layout descriptor, or passes a zero that requireCalleeIgnoresParametricWitness proves nothing reads, refusing with E3132 where something does.

A match arm’s payload bindings are not a one-to-one map between names and payload slots, or an or-arm covers a case that does not bind a slot the arm’s bindings read. An arm’s payload bindings are loaded ONCE, unconditionally, at the head of the arm BODY, and every alternative of an or-arm branches to that one body. Two consequences, and this code carries both: the bindings must be a BIJECTION (one name per slot, one slot per name), because the load is a list walk and the scope install is keyed by NAME and overwrites; and every case the arm covers must itself bind each slot the arm reads, because the load runs on all their paths. So an arm that binds a payload covers exactly one case. Refused shapes include:

  • a payload-less case beside a binding one (stay or walk(dir) gives dir): on the stay path dir would hold a value no pattern bound.
  • a payload-carrying case named bare beside a binding one (shout or speak(msg)), for the same reason.
  • the SAME SLOT bound by two alternatives (shout(msg) or speak(msg)), which emits two loads and two acquisitions against one slot: on a sole-owned scrutinee the first moves the String out and nulls the slot, and the arm body holds null.
  • the SAME NAME bound at two DIFFERENT slots (walk(dir) or run(_, dir)), which passes every slot test and is then decided by Scope.install, keyed by name and last-wins: the arm read slot 1 on the walk path, printing 0 where 7 was stored. The same hole existed one construct over for a single case’s own list (walk(x, x)), so ONE check over the arm’s finished binding list serves both doors.
  • a payload binding on an arm of a match over a combined error (a block-form try’s handler, an awaited service reply) that names cases of more than one error type: each type lays out its own value – a union’s is a box with its own slots, an enum’s an ordinal with none – so a slot of one is no slot of another. It is the and fallthrough rule one construct over (Parser.rejectFallthroughIntoBindingArm), which refuses a related hazard for a related reason: an arm body reached from a case that does not hold what its bindings destructure. The cure is to give the disagreeing case, or each error type, its own arm, or to rename the colliding binding.

E3130 — semanticGrantedConformanceMemberMismatch

Section titled “E3130 — semanticGrantedConformanceMemberMismatch”

A payload-free enum declares a member named after a requirement of a conformance the COMPILER grants it – hash or equals – with a signature that does not implement that requirement. An enum without associated values conforms to Hashable and Equatable by declaration alone (specs/enum-hashable.md), with no implements clause anywhere. So nothing an author writes asks for the conformance, and this check is what holds a member that collides with one of its names to the requirement, as checkConformance holds a type X implements Hashable to each of its own (E3016). The member is not dead: it WINS, at both doors. e.hash() resolves to it as an ordinary method call, and ProgramSignatures.enumConformanceImplName stamps it into the enum’s __witness_<Enum>.Hashable slot so a Map/Set keyed by that enum hashes through it too – which is the point (the two doors must reach ONE body, or a map and a direct call disagree about one enum). This code states the requirement the grant implies. Without it, an enum declaring hash() returns String is stamped into a slot the probe calls as returns i64, so a String record POINTER is used as a hash and then leaked – map.get answers 0 and the process exits 101. The cure is to make the member match the requirement it is named after, or to rename it. The compiler’s own implementation is used for every enum that declares neither. The member checked is one the enum’s own layer declares. An extension in a layer above the enum’s own, such as a program’s on a standard-library enum, may not declare hash or equals for it at all: that is E3006 at the member’s name, whatever its signature.

An as names a GENERIC INSTANCE as its cast target – col as RegNumColumn. Every other cast this compiler performs is a RETAGGING or a scalar conversion of one value; a container is neither, because its elements have a storage layout of their own and the two layouts need not agree. Array with int(0 to u64.max) strides EIGHT bytes per element and Array with int(0 to 63) strides ONE (rangedAliasStorageBytes), so retagging one as the other hands every later read a stride the buffer was not written at – the silent wrong answer specs/bytearray-element-size.md measures at length. Converting instead would mean allocating a second buffer and copying every element through a range check, which is a real operation and not something an as should perform in silence. Accepting the spelling and doing nothing would leave the value at its original type and the program failing later, at whatever use site first noticed, naming neither the cast nor its target. Build the container with the element type you need, or convert it element by element. One cast is legal: between two instances whose elements are same-named typealias declarations of one layout – the same underlying type, range and domain (implements is not part of it). That cast re-brands the container and moves no element.

E3132 — semanticParametricConstraintWitnessRead

Section titled “E3132 — semanticParametricConstraintWitnessRead”

A call passes the hidden witness table for one of the callee’s where constraints, the type argument at that constraint is a generic instance written over the CALLING body’s own type parameters, the conformance behind it has impls that carry a hidden dictionary, the calling function has no layout descriptor to take the table from – and the callee READS that witness parameter. Such an instance has no static table. A witness table is .rdata, and the slots of a dictionary-carrying conformance point at adapters that must supply the instantiation’s layout descriptor, its fixed element count and its own constraint witnesses; for ArrayIterator with Element inside a body still generic in Element every one of those is a run-time fact of the ENCLOSING FRAME, and no static blob can carry it. A method of the enclosing type that carries its layout descriptor takes the table from that descriptor, which is minted for the concrete instance and holds the table for it. E3128 is the same wall one mechanism down, reached from the table rather than from the argument. Where the callee never READS the parameter the call passes a zero and this check is what makes that sound rather than a guess – exactly as LowerMaxonToStd.appendNullAdapterDictionary passes a null dictionary and requireWitnessSlotImplIgnoresDictionary proves the impl reads none of it. The test is USE and not read-of-a-particular-kind: a witness that is dispatched through, forwarded to another dictionary-passing callee, or merely stored is equally a value the caller cannot supply. stdlib/Interfaces.maxon’s extension Iterable.withIterator is the shape that passes the check – WithIterIterator.create returns a bare Self struct literal and dispatches nothing, while the current()/advance() a for-loop then drives are reached from a CONCRETE instance that mints a real per-instance table. The cure is to reach the constrained method through a concrete instance – bind the enclosing body’s type parameter before the constrained type is built – or to make the conformance’s impls independent of their type argument so no dictionary is needed at all.

E3133 — semanticWhereConstraintBindingDisagreement

Section titled “E3133 — semanticWhereConstraintBindingDisagreement”

A where constraint BINDS the constrained interface’s associated types – where Source is Iterator with Element – and the type argument supplied at an instantiation conforms to that interface while binding one of those positions to a different type. The binding is not decoration. Inside the shared generic body the receiver of a witness dispatch is a value of a type PARAMETER, which carries nothing about what the conformance behind it bound, so the constraint’s binding is what types the dispatch’s RESULT (Parser.associatedReturnThroughConstraintBinding) and its associated FORMALS (LowerMaxonToStd.associatedFormalType) – and it is what lets E3119 stop asking every conformer of that interface to agree about the position, because this dispatch SETTLED it. One body is compiled against that answer and every instantiation reuses it, so a conformer binding the position otherwise has its bits read as the wrong type. That is E3119’s own recorded failure – with String beside with Integer SEGFAULTED (exit 139), with float answered 31 where the program computes 51, and a ranged binding RANGE-PANICKED – reached one indirection later. It is the where-clause twin of E3127, which asks the same question of a value WIDENED into a parameterized existential, and it is checked at the same moment E3017 is: the instantiation site, where the type argument and the constraint first meet. The cure is to bind the constraint to what the conformer declares, or to supply a type argument whose conformance binds what the constraint states.

spawn starts a SERVICE, and a service is started from a STATIC FACTORY of a declared type that returns that type – spawn Calc.create(). There is exactly one form, and this expression is not it. The cases are: nothing declares the type; the type is declared but nothing declares the member; the member is an INSTANCE method (a spawn calls the factory directly, so there is no service yet for a message to reach); or the member is a static that returns something else, which has produced no state for the message loop to own. A qualified target is read as any qualified name is: a chain whose qualifier names no binding, directory or type is refused here, and so is one whose head is a binding in scope (with let sub = … in scope, sub.Calc reads that value). A default’s spawn is held to the same rules. A bare spawn f() over a free function is refused here too, and deliberately: there is no unstructured green thread in this language. The unit of concurrency is a service, whose message surface the compiler can check. The cure is to name a static factory of the type you mean to start.

A member was called on a service or interface HANDLE that is not one of its messages. A handle’s surface is exactly its service type’s export INSTANCE methods, one variant of the synthesized request union each. That is the isolation boundary: a private helper is not on the handle, so a call to one from inside a message body is a DIRECT call on the service’s own state. On a service’s own handle, two shapes reach it, and the message tells them apart because the cures differ. The member may be DECLARED on the service type and merely not exported – a private helper, or a static, which has no receiver and so can never be a message – in which case export makes it one, or the value can be reached through a plain (unspawned) value of the type. Or nothing declares it at all, which is an ordinary misspelling. On an interface handle, the member can also be a requirement of the interface that the handle cannot send. A send through the handle may reach any service implementing the interface, so each of them must declare the requirement as an export instance method. When one implements it another way, such as a private method, the message names that service; when no implementing service declares it, the handle has no such message. Declaring the requirement as an export instance method on each implementing service makes it sendable. It is neither E3018 (a missing FIELD) nor E3004 (an undefined FUNCTION): the member usually exists, on the type, and saying otherwise would read as a typo.

E3140 — semanticServiceReplyNotCarriable

Section titled “E3140 — semanticServiceReplyNotCarriable”

A spawn makes a type a SERVICE, and one of its reply-bearing messages declares a reply the compiler cannot carry back to a sender. A reply resolves through a CELL – a green thread that never runs – and a cell carries the value, one error word, and the witness half of a value held at an interface type. The VALUE word is one machine word the awaiter reads back verbatim, so it holds what a green thread’s result register holds: an integer, a bool, a String, a struct, a service handle, or the value half of an interface-typed value. A float comes back in a floating-point register the cell has no slot for; an opaque type parameter is released through a companion the cell does not carry. The ERROR word holds the handler’s ordinal + bias, so a payload-free enum fits it exactly. A payload-carrying union’s flag is a heap BOX POINTER instead, and a float-backed enum’s tags are IEEE-754 bit patterns that can span more of the i64 range than the line a try await fuses the send’s error and the handler’s on can hold. It fires at the spawn rather than at a send, as every service diagnostic does, and for a reason of its own beyond the usual one: the message dispatch the compiler synthesizes completes a reply for every reply-bearing message of the type, so a message the cell cannot carry would put a wrong-width store into a body the service really runs, whether or not the program ever sends that message. The cure is to return a value that fits the word and throw a payload-free enum, or to drop the returns and throws clauses – which leaves the message no reply to carry.

A promise owns a green thread, and a green thread has exactly ONE owner at every instant – awaiting it consumes it, so under the ownership model it is a mutable value and cannot be borrowed. Reading a promise out of a container is therefore a MOVE, not a copy: the slot it came from must be emptied when the read is consumed, or the container’s element walk reclaims a thread the consume already reclaimed. This refuses the reads that CANNOT NAME the slot they came from, because a move with nowhere to record its source cannot be finished: a list’s value() or its iterator’s current(), last(), a library member handing back a pair that carries a promise the container still holds, and a consume of a promise no frame owns (read twice from one slot, or merged from two branches). A member of a user type, a pop of its own included, is judged by its body: it moves its element out when every return hands back what a library pop/remove took out of a field of self (directly, through a var local bound to one, or through another such member of a field’s type), or a parameter every declaration of it takes; one that returns a borrow (self.items.last()) is refused. A static of a generic type that hands back a promise an argument holds – an instance passed in, or an array, map, tuple or struct reaching one – is refused on the same terms, unless every declaration of it takes that argument. A struct FIELD is a slot on the same terms as a container element, and every door that spends a promise asks this – await, .cancel(), a store into a container, a store into a field or a union case, an argument at a parameter the callee takes, an otherwise fallback merged into a try’s result, and a return – so a read whose slot another read already consumed is refused wherever it is carried, naming the word the source wrote for that door. A return is refused for a promise no frame owns: a merge of two promises (p if c else q) or a second name for a parameter. Return one this frame owns – a spawn, a pop/remove, or the parameter itself. An array cursor’s current()/peek(n) and a for (it, p) in a.withIterator() destructure are NOT refused: each names the array slot its cursor stands on at the read, so an await empties that slot. The cure is a read that names its slot – get(i), first(), for ... in, or an array cursor – or a move-out (pop, remove), whose result the caller owns outright. It is NOT about the promise being un-awaitable: every one of these reads yields a perfectly good promise. It is about there being no way to say which slot stopped owning it. A COPY is refused for the same reason: a clone() (a List’s included), or an array’s slice or append, of anything that is or holds a promise – through a struct field, a union payload, a generic instance (Map, Set, a declared Box with T) or an array element – would give two owners one thread. A generic type whose body copies an Array with T field is refused where the program instantiates it with a promise. await the promise and copy a value holding its result. An async call refuses a promise, or a value whose type holds one, at a parameter the callee only reads. A coroutine can still be running after the frame that started it has ended, and by then the promise may have been awaited out of what holds it and its thread reclaimed. Pass the promise to a parameter the callee takes (one it awaits, cancels, stores or returns), or await it and pass the result. A closure may not give away a promise it captured, since its body may run any number of times; in a generic body that is a captured T stored or returned where the program instantiates T with a promise or a type holding one. Await the promise in the function that spawned it, or hand the closure what it needs as a parameter.

A promise is USED after it was consumed. A promise owns a green thread, and a green thread has exactly one owner at every instant, so await and .cancel() CONSUME it – the runtime reclaims the thread’s struct there. Any later use of a name that still spells that promise reads a struct already back on the scheduler’s free list. Poisoning follows the VALUE, not the text: an alias (let q = p) names the same thread, so consuming through either name consumes it for both – and a NON-consuming read of the alias (q.inner) is refused here even though no second consume exists for the linearity pass to find. Re-arming the binding from a fresh async spawn mints a new thread and revives the name. This is the parser-time, value-keyed half of the rule. E3100 is the flow-sensitive backstop for a second consume that this half cannot see – across a loop back edge, where one lexical await consumes one thread on every iteration.

A union case’s payload argument carries a name: label naming no payload of that case – TwoParts.values(10, z: 20) where the case declares a and b. NOT E3018, which is about a FIELD: a payload is a positional slot of one case, not a member of the union, and a message calling it a field names a thing the program does not have. The two mistakes also have different cures – a field typo is fixed against the type, a payload label against the CASE – so the diagnostic names the case rather than the union alone.

E3145 — semanticServiceReplyInstanceUnknown

Section titled “E3145 — semanticServiceReplyInstanceUnknown”

A message whose reply is typed at a GENERIC service’s own type parameter is sent through a handle that no longer says which instantiation it was started at. A generic service has ONE <T>.handle companion, whatever it is instantiated at – one union and one handle struct per service, never a pair per instantiation – so which instantiation a handle belongs to is carried on its TYPE. <T>.handle with <Args> is a generic instantiation like any other and can be written; the BARE <T>.handle is the base, which fixes nothing, so a slot spelled that way has dropped the very fact the reply needs. That matters for exactly one shape. A reply typed at the type parameter is produced inside the handler, where the instantiation’s layout descriptor says what the type parameter is; the awaiting frame has only the handle, so a handle that names no instantiation gives the awaited value no type any member, conversion or otherwise branch can be checked against. Every OTHER message through such a handle is unaffected and stays legal: a reply typed at a concrete type, and a message with no reply at all, need nothing from the instantiation. The cure is to spell the instantiation – a typealias over <T>.handle with <Args> carries the reply’s type through a parameter, a struct field or an array element – or to send the message where the binding the spawn produced is, which carries it already.

A match arm over an enum, union or error union writes a RANGE of cases – add to mul, red upto blue. An arm names its cases explicitly: an or-chain, one case per line. A range covered the cases whose DECLARATION POSITION fell in its span, so a case appended inside that span was absorbed silently and exhaustiveness never fired – the arm handled a case nobody had decided about. Naming each case is what makes E2026 point at every match site when an enum grows. Raised as soon as to/upto is seen, BEFORE the upper bound is resolved, so red to nope reports this rather than E3034: the range is the mistake, not the name. SCALAR range patterns are unaffected – 1 to 10, 'a' to 'z', min upto 0 are values in an ordered domain, where a new value between the bounds cannot appear behind the author’s back. So is the ranged type alias int(0 to 100).

A match arm’s or-chain packs two alternatives onto one line. Every alternative takes its own line, the chain continuing after a trailing or: call or literal or ret then break ‘op’ One case per line is what keeps an arm readable once cases are named rather than ranged – an arm may cover twenty of them – and it makes adding or removing one a one-line diff. A single-alternative arm has no chain and is unaffected.

bits(n) was written with a width the language does not have – bits(5), bits(0), bits(128). The legal widths are 1, 2, 4, 8, 16, 32 and 64, and they are not an arbitrary list: they are exactly the widths a slot or a sub-byte packed field can hold. 8/16/32/64 are the 1/2/4/8-byte slots the storage ladder produces; 1/2/4 are the packed widths that DIVIDE a byte, so a field never straddles one. A width outside that set has nowhere to be stored. NOT E3005, which is about a VALUE outside a range: this is a range that cannot be declared.

A --define named a top-level constant that no file declares. It is an ERROR and not a shrug because the flag’s whole purpose is to change a value: one that changes nothing is a typo, and the build it produces looks exactly like the build it was meant to replace.

A --define name matched more than one declaration. Two directories may each declare a constant of one name, and a namespace is a rendering of a DIRECTORY (my.dir/ and my/dir/ both spell my.dir), so even a qualified name is not self-evidently unique. Both claimants are named, because the fix is to pick one and there is no picking without seeing them.

A --define named a constant whose initializer is not a lone string literal. Only a plain default can be replaced: an expression’s value is computed from the source, so overriding it would mean the binary disagreeing with code a reader can see.

A source file OUTSIDE runtime/ called a __Raw.* intrinsic. __Raw is the closed table of raw machine and OS operations the language runtime is written on top of — the one surface below which there is no Maxon — and reaching it directly from a program would put a raw machine operation in user code with no runtime between. NOT E3004: the name IS defined, and telling this author “no such function” would send them looking for a typo instead of for the rule.

A runtime/ source file admitted a managed value — a String, a container, a closure, or a struct with a managed field. The reference-counting pass emits __mm_incref/__mm_decref around such a value, into the very tier that DEFINES those entries: the runtime function managing it would be lowered with bookkeeping that calls the function being lowered, a circularity with no fixed point. Three positions answer it: the TYPE the file spelled (a field, a return, a parameter, a cast target), the NAME a binding gave a value whose type was never written, and the CONSTRUCT that built a value no name and no written type reaches — a for element, a caught error, a match payload, a temporary. The third is the complete one, raised off the parser’s value type columns; the first two are asked earlier because a spelled type and a bound name make a sharper sentence than a construct does. Asked at all three, the legality of a runtime file never turns on which optimizations elided its retains.

A runtime/ declaration is marked export (global) or public. runtime/ is loaded into every program, so such a declaration contests names with the programs the tier is linked into, the compiler compiling itself among them. An unmarked declaration is the widest visibility that still gives the runtime the file-to-file sharing a runtime split across several files needs.

A source file named a compiler-internal or runtime entry as a function VALUE — let f = __parallel_boundary. It is the value-position half of the rule E3004 states for a CALL, and its sentence is E3004’s own explanation under a different lead, derived from the one classifier (MmRuntime.reservedCalleeReasonOf), so the two halves cannot drift.

NOT E3004, for E3152’s reason one code over: E3004’s subject is a CALL. The registry names it callUnknownFunction, SemanticCheck.validateCall raises it for an ordinary undefined callee, and the word “call” in its sentence would be false of a let binding — a reader shown “call to” on a line with no call is being told something that is not there. The value position’s own undefined-name code, E2004 “Undefined variable”, is wrong in the other direction: the name is not undefined, it is the compiler’s and this file may not write it.

ONE RULE, TWO CODES is the cost, and it is paid deliberately: what makes E3004 and this one one rule is the classifier they share, which is a single derivation rather than a number.

E3156 — interfaceParameterInFunctionValueTarget

Section titled “E3156 — interfaceParameterInFunctionValueTarget”

A named function whose PARAMETER is held at an interface type was used as a function VALUE. A function value is called through one uniform indirect ABI, which carries one machine word per argument, and an interface-typed parameter reserves an adjacent witness word beside its value half — a word the indirect call has no slot for, so the callee would dispatch through whatever the register held. The DECLARATION is not what is refused: a direct call reserves that slot and fills it, which is why this is not one of the declared positions E2015 covers. It is the parameter twin of the function-value RETURN position, which E2015 does cover, and it is refused later than that one because the answer needs resolved parameter types.

A runtime/ body spelled both frame directives — __Raw.ownFrame(), which says the frame IS the body’s product and nothing may splice it away, and __Raw.splicedAtEverySite(), which says the body has no frame worth keeping and the inliner must splice it into every call site. The two cannot both hold, and neither is the obvious winner: resolving it by precedence would answer one of the two questions the author asked and say nothing about the other. Positioned at the second directive.

A body declaring __Raw.splicedAtEverySite() is still reached in the finished program. The row is the body’s promise that it exists at no call site, and it overrides the inliner’s COST rules alone: the safe-point boundary, a by-reference parameter, the green-thread stack guard, an op the splice cannot copy, a ```RequiredFunctions request for the body and a cycle of such bodies all still refuse it. This is what that refusal must never be allowed to be silent about — a family ported on the strength of the row would otherwise ship at exactly the cost the port was written to remove, behind a call its author was told would not exist. Asked of the SURVIVING module after the last splice round, so a site no round was offered is caught by the same sentence. Positioned at the body’s own declaration, naming the reference that survived and the rule that refused.

A handler over a combined error – a block-form try whose calls throw several error types, at least one of them a union with payloads – does not match its (e) exactly once on every path. Such an error may arrive as a heap box, and the box is released by the arm of the match e that runs, because only an arm knows which type is in flight. So a second match e on a path (in sequence, inside an arm, or inside a loop the handler opened, its while condition included) reads a released box, and a path that leaves the handler without a match e – falling off its end, a return, throw, break, continue or propagated error before the match, or skipping a match on the right of and/or or in an arm another arm falls through into – never releases it. The check is path-sensitive: a match on each arm of an if/else is one match per path, and statements before the single match are legal. A panic ends the program and owes nothing. The cure is to match e once and bind in its arms whatever the rest of the handler needs.

A call’s subject is a generic type named without with arguments that nothing binds — written statically (Box.create(first)) or as the type of the receiver. Such a base has no instance behind it. Inside a generic type body whose parameters do not bind it by name (Box uses Element inside type Outer uses T), the call may not hand a slot written over one of the base’s type parameters (Element, Array with Element) a value typed at the enclosing type’s parameters (nothing would release what it stores), and may not reach a callee that needs a layout descriptor (the base has none, and the enclosing frame’s describes the enclosing type’s parameters). Outside a generic type body, a layout-needing callee, static or through a receiver, is refused where the calling function has no descriptor of its own (Holder.create() in main). A static call whose arguments fix every parameter to a concrete type, through parameters written at a type parameter or at an instance over one (Array with T), names that instance and is not refused. A static whose result is written over a parameter that no argument fixes (Holder.make() declared returns T) has no type and is refused, outside the generic’s own body. Name the instance with a typealias: typealias Inner = Box with T.

E3167 — semanticSignatureTypeLessVisibleThanDeclaration

Section titled “E3167 — semanticSignatureTypeLessVisibleThanDeclaration”

A declaration exposes a type less visible than the declaration. Whoever may reach a declaration must be able to name every type it exposes, so each type an exported surface names must carry a written visibility at least the surface’s own. The tiers, narrowest first: no modifier (unexported in the message), export, public. The surfaces, with the noun and the position the message gives each:

  • a function: each parameter type (“in the type of parameter ‘p’”), the return type (“in its return type”), the throws type (“in its throws clause”), and the where clause of a generic function or an extension (“in its where clause”);
  • an export or public binding – a top-level let or var, or a static let or static let member – (“in its type”): the type its initializer gives it, written or inferred, and the typealias the initializer was spelled through (50 as Small, Tallies.create()); the subject is a “constant”;
  • an instance “field” (“in its type”), at the narrower of the field’s own modifier and its type’s; an unmarked field is asked nothing;
  • a “union case”, at the union’s tier (“in the type of payload ‘v’”);
  • a “typealias” (“in its target”);
  • a type, enum or union’s implements clause and its with arguments (“in its implements clause”);
  • a type’s where clause (“in its where clause”);
  • an “interface”’s extends clause (“in its extends clause”);
  • a struct-backed “enum”’s backing record (“in its backing record”). Every type name a surface writes is judged, and so is every name reached THROUGH a typealias it names – a generic alias’s base type and type arguments, a tuple alias’s elements, a function alias’s parameter and return types – each read as the alias’s own file means it. A type body’s inner typealias is judged by its own modifier before its right-hand side is walked. A type parameter, a primitive and a tuple itself name no declaration and are asked nothing; a service’s handle is its service’s tier. A member’s OWN modifier decides, not its enclosing type’s, so an export type may hold a public method and that method is held to the public bar. An interface’s members take the interface’s modifier, because a conformer’s caller reaches the requirement through the interface. A service’s message is held to the narrower of its own modifier and its service type’s, because it can be sent only through a handle to that service. Reported once per offending type and position: a field or payload at the type it writes, any other surface at the declaration’s name. Example: exported field 'api.Holder.mode' names unexported enum 'Mode' in its type. Raise the type to the surface’s tier, or narrow the surface to the type’s.

A function declares throws E, but nothing in its body can throw. An error leaves a function through a throw, a default throws, an otherwise that throws, or a bare try that passes the callee’s error on; a handled try … otherwise, an if try, and a throw caught by a block-form try handler stay inside it. The clause would make every caller write try for an error that cannot arrive. Remove the clause, or throw from the body. Reported once per declaration, at the function’s name. A service message is held to it like any function. The entry function (E3054), a test body, and a method implementing an interface requirement whose clause E3016 fixes are exempt; a clause E3113 refuses is reported by E3113 alone.

Two default declarations name one key at the same level: two in the program’s own files, or two in the standard library. A program’s default replaces the standard library’s for the same key, so only a pair on one side is ambiguous. The default kept is the earlier one within a file, and across files the one in the file whose absolute path, with / separators, sorts first byte by byte; each other one is reported at its key, with a note at the kept one. Delete one of them.

E3170 — registryDefaultServiceDoesNotImplementKey

Section titled “E3170 — registryDefaultServiceDoesNotImplementKey”

A default whose key is an interface does not build a service that implements it. An interface key is a service key: its expression must spawn a type declared implements that interface, and Key.current() returns a Key.handle to it. Reported at the key. Declare the spawned type implements Key, or spawn a type that does.

A value is handed to every thread at once and its graph cannot be shared that way. The doors are a default value key’s type and value, the element type of a SharedValue, freeze, SharedValue.create and publish, and a value key’s register. Readers take the value with no lock, so every count in its graph is made atomic by a share walk before a second thread sees it, and the walk must be able to mark everything the graph reaches: a function value (a closure record owns what it captures), a promise (one owner reclaims its green thread) and an OS handle cannot be marked. A value held at an interface type is walked through whichever conformer it holds, so every conformer the program converts to that interface is judged at the door: the message names the interface, the conformer and the field, and a note points at the conversion. A door is judged for every cause in a program that spawns a service, and for a promise in every program; a key’s or a SharedValue’s type is judged where it is written. Fields may be var and may hold containers: every reader sees the value read-only (E3197, E3207). Hold that part in a service, or use a separate interface for the values that are shared.

Building one default reaches the lookup of another whose build reaches back, or its own lookup. Defaults are built before main in dependency order, so a cycle has no first member. Reported at the first key of the cycle, naming every key in it. Build one of them without looking up the other.

E3173 — registryReachedFromGlobalInitializer

Section titled “E3173 — registryReachedFromGlobalInitializer”

Key.current() or Key.register(…) is reached from a module-level or static global’s initializer, directly or through the functions it calls, dispatches included. Global initializers run before any default is built, so the slot is still empty there. Reported at the call, naming the global. Call it from main, or from a function main calls.

E3174 — registryPublishedValueNotSolelyOwned

Section titled “E3174 — registryPublishedValueNotSolelyOwned”

A value handed to Key.register or SharedValue.publish has another owner: a second live name binds it, or it is held somewhere the caller does not own outright (a record whose fields are all let is shared and published as it is). A published value is read by every thread at once and freed only when no reader can hold it, so no one may write or free it behind the registry. Reported at the argument. Publish a .clone(). A tuple none of whose elements owns heap is copied and the copy published.

E3175 — registryKeyDeclaresARegistryMember

Section titled “E3175 — registryKeyDeclaresARegistryMember”

A type that is a default key declares its own static current or register. On a key, current and register are the registry’s members, so the type’s own would never be called. Reported at the type’s member; the note is the default. Rename the member.

E3177 — interfaceHandleImplementersDisagree

Section titled “E3177 — interfaceHandleImplementersDisagree”

A message is sent through an interface handle I.handle, and two service types implementing I declare that requirement with different parameter, return or throws types. The handle sends one request and awaits one reply for every implementer, so their shapes must agree. Reported at the member name of the send, naming both services. Send through each service’s own handle, or give the requirement one shape.

A typealias’s implements clause names a parent its range does not fit. The alias’s bounds must lie inside the parent’s, over the same primitive and signedness: int(0 to 9) implements Small where Small is int(0 to 5) is refused, and so is a float alias implementing an int one. Reported at the clause. Narrow the alias’s range, or implement a wider parent.

E3179 — genericTypeParameterNotInferable

Section titled “E3179 — genericTypeParameterNotInferable”

A generic function’s type parameter cannot be inferred: no parameter is declared with it. Reported at its name in the uses clause. Declare a parameter of that type.

E3180 — genericArgumentsHaveNoCommonType

Section titled “E3180 — genericArgumentsHaveNoCommonType”

A generic function’s arguments give one type parameter two types with no common one: two different kinds (int and String), or two typealiases that implement no alias in common. Reported at the call, naming both. Cast one argument so the two agree.

A generic function’s type parameter would be inferred from an argument of a kind it cannot take. A type parameter binds a number (a ranged typealias included), String, bool, Character, a type declaration or an enum; a function value, an Array or other generic instance (whichever typealias names it), an interface value or a cstring is none of those. Reported at the call.

A directory holding the program’s source cannot be spelled as a namespace. Each directory is a namespace written with its path’s pieces joined by dots (app.ui.Button), so every piece must lex as one name, and the first must not be a keyword or a qualifier the language already owns: export qualifies the project root, stdlib names the standard library, runtime the runtime tier and scriptlib the scriptlib packages. Reported when the program is loaded, naming the directory and the piece. Rename the directory.

A closure, or a value holding one, is stored into a record the closure captures or a record that record reaches. A closure holds a counted reference to every record it captures, so the record would hold the closure and the closure the record, and neither would ever be released. The store is followed through fields, array elements, union payloads, tuples, struct literals, clones, returned values and the callees a closure is handed to, in the order the stores run, and each cycle is reported once, at the store that closes it. Store the closure somewhere the captured record does not reach, or capture the value the closure needs rather than the record holding it.

A field of a generic type holds that same type again over a type built from its own type parameters, directly or through the fields of other generic types: var deeper as Nest with (Pair with (T, T)) inside type Nest uses T. Nest with int then holds a Nest with (Pair with (int, int)), which holds one over a larger pair still, so the instances the program needs never end. Reported at the field’s type. Declare the field over the type’s own parameters (Nest with T), or remove the recursion.

A source file outside stdlib/ and runtime/ reached the raw memory surface: a __Builtins call, a .managed field, a __ManagedMemory or __ManagedMemoryCursor type or method, .cstr() or the cstring type, a promise’s .inner handle, or a raw handle type (__ManagedFile, __ManagedDirectory, __ManagedSocket, __ManagedPages, __ManagedHandle, __ManagedPin). These read and write memory with no bounds or ownership check, so only the library tiers may name them; a program reaches the same facilities through the standard library’s checked APIs, which the message names where there is one (Process.id(), HeapStats.slab(), Scheduler.counters(), File, isComplete()). A raw type named as the base of a static call, a static read, an async spawn or a module-level initializer is such a use. Reported once per file, at its first raw use. __Raw is narrower still: E3152.

E3186 — argumentOverlapsWrittenParameter

Section titled “E3186 — argumentOverlapsWrittenParameter”

A local handed to a mutable parameter is lent to the call as a by-reference cell, and the call overwrites it once the call’s own operands have run. The same statement reads that local before the write: an earlier operand, another argument of the call, the condition of a ternary that wraps the call, a closure literal that captures it, or the cell of another mutable parameter the callee writes. A hold cannot protect a value its cell overwrites, so the statement is refused. The refusal is per root binding: it counts reads of the local the cell is rooted in and of that local’s field paths (bump(h.n, h: h.copy())), the fields of self sharing the one root self, and a module being one root. Another name for the same record, a let alias or a var that took the record by move, is not that local. A read that runs after the write sees the new value and is accepted. A call receiver that is itself a by-reference writer is judged after its arguments, and is refused when an argument reads the root it writes. The cell counts only when the callee writes the parameter, directly or by forwarding it to a mutable parameter that is written; a mutable parameter the callee never writes reads like any other operand. A call through an interface requirement or a function value counts every mutable position as written. Reported at the by-reference argument. Copy the other operand into a let in an earlier statement (.clone() a record, array or string) and use the copy; for another by-reference cell, copy it into a var, pass the copy for that operand and store it back after the call.

E3187 — comparisonMethodWritesItsParameter

Section titled “E3187 — comparisonMethodWritesItsParameter”

A method behind the comparison operators writes its operand or its receiver. == and != call equals, and <, <=, > and >= call compare, so a method of either name that takes one operand besides its receiver may not write that operand or its receiver – reassigning it, writing a field or element of it, keeping it where something may write it, or handing it to a function that does. Reported at the method’s declaration, whichever type declares it and whether or not it implements Equatable or Comparable. Write the comparison so it only reads both sides.

A message that returns a value or throws is sent as a bare statement. Its send delivers a reply, and a statement keeps nothing, so the value and any error the handler throws would be lost. Reported even when the send’s own error is handled (try h.m(x) otherwise ignore): the reply is the fault. Await it with try await h.m(x), keep it with let reply = try h.m(x), or discard it on purpose with _ = try h.m(x). A message that returns nothing and throws nothing has no reply and may be sent as a statement.

E3192 — semanticServiceSendTimeoutReserved

Section titled “E3192 — semanticServiceSendTimeoutReserved”

sendTimeout: is reserved on every message call: it is how many milliseconds the send waits for room in a full mailbox before it fails mailboxFull, and it stays with the send. Reported at a spawn whose service declares a message with a parameter named sendTimeout, and at a sendTimeout: argument with another argument after it. Rename the parameter, or move sendTimeout: to the end of the argument list.

E3193 — semanticInstanceMethodCalledWithoutReceiver

Section titled “E3193 — semanticInstanceMethodCalledWithoutReceiver”

An instance method is called with no value to call it on: a bare call to a sibling instance method from a static method, a file-scope initializer or a static let initializer, none of which has a self, or Type.method() with an empty argument list. Call it on a value, value.method(…), or pass the value as the first argument, Type.method(value, …); or declare the method static if it uses no instance state.

A fixed array’s ‘create’ is called with the wrong arguments for the form of its type. A type that states its length (‘Vec3’ for ‘FixedArray with 3 Int’) takes none: write ‘Vec3.create()’, or ‘Vec3.create(value: v)’ to start every element at ‘v’. A runtime-sized type (‘Buf’ for ‘FixedArray with Int’) needs its length and takes an optional ‘value:’: write ‘Buf.create(n)’ or ‘Buf.create(n, value: v)’. Any other argument is refused, because a fixed array never grows; for a growable buffer write ‘Array.create(n, zeroed: false)’.

An Array or ByteArray is created with no capacity: Items.create(). Every array states how much it holds when it is built, so write create(0) for an empty array, create(n) for n zero elements in one allocation, or create(n, zeroed: false) for an empty array with room for n. A collection whose length is fixed once it is filled is a FixedArray.

E3196 — semanticCapabilityMismatchAtStore

Section titled “E3196 — semanticCapabilityMismatchAtStore”

A value is stored into a slot whose capability differs from the value’s. The slot is a field, a container element, or a parameter the callee stores (List.append, Map.upsert, Array.insert), and a type argument carries a capability: List with Box holds mutable Box values and List with immutable Box holds frozen ones; a union payload takes the word too (named(let text immutable ByteArray)). Refused: a mutable value into an immutable slot (freeze it, or store a copy), an immutable value into a mutable slot, an isolated value into a mutable slot (merge it first), and a read-only value into a mutable slot (store a copy). Constant data (a constant let, a b"..." literal) and a read of an immutable slot are immutable, so storing one into a plain field, element or payload says which declaration to change (declare the field `immutable ByteArray` , or the element, or the payload). A field default that names constant or immutable data (var names = sharedNames over a module let) stores it into a mutable field and is refused the same way: build the value fresh in the default, or declare the field immutable. Reported at the stored value.

A write goes through data that is immutable or read-only: a field or element assigned through a frozen value, through the result of joining immutable and mutable data, or through data outside an open modify block, whose roots stay read-only while the block is open. A closure that writes a name it captured is judged at the capture the same way, so the captured name must be writable where the closure is made. The elements a for loop hands out over a read-only List (frozen, or a module let) or over a collection whose element type is immutable (Array with immutable Box) are read-only, and so is what an extension member returns out of an instance with immutable elements, and the result of a function whose return paths mix frozen data with writable data, whatever the receiver is. The root that holds a unique value a match arm or for loop lends out of a field path (match h.u) is read-only while the arm or body lends it. Reported at the write. Write through a mutable value, a clone() for one, or make the write where the data is still writable; a function whose every path is frozen declares returns immutable.

E3198 — semanticIsolatedReadOutsideBlock

Section titled “E3198 — semanticIsolatedReadOutsideBlock”

An isolated value is used where its region is not open. Refused: modify of a value that is not isolated (declare it as isolated T), swap of a path that is not an isolated field or element, and a read of an isolated field, element or payload outside a block that would become another holder’s data: bound, stored, returned, captured by a closure, frozen, put in a tuple, union or constructor, or handed to an async call, a message or a parameter that keeps it. The read stays one through a join, a field of it, a call given it, and each element a for loop hands out over an isolated collection field. Open the value with modify, take it out with swap, or keep a .clone().

E3199 — semanticIsolatedHolderNotWritable

Section titled “E3199 — semanticIsolatedHolderNotWritable”

An isolated value is reached through a holder that is not writable: it is opened, swapped, or moved on (bound, assigned, stored, given or returned) while the value that holds it is immutable, read-only as the result of joining immutable and mutable data, or outside an open modify block, where every root other than the opened value is read-only. An isolated value older than the innermost open modify or acquire block is such a root: a local or parameter declared outside it, a mutable isolated parameter (the caller’s variable), a local or call result it was moved into, and the payload a match of it bound. Passing it in an unmarked position (argument or receiver), reading or writing through it, and a nested modify of it open it. It still moves into an isolated parameter or slot, is sent, or is merged. A mutable isolated parameter open in its own block is read inside a block nested in it. Reported at the isolated value. Open it from writable data, or inside the block that opened its holder, or before or after the block.

E3200 — semanticIsolatedRecoverNeedsCleanInputs

Section titled “E3200 — semanticIsolatedRecoverNeedsCleanInputs”

A position that needs a region of its own, or freeze or merge, is given a value that is not clean. An isolated local, parameter, field or result takes only a clean call (one whose inputs are all values, immutable data or moved isolated data), a swap, or an isolated local that is moved; a mutable local is part of the current region and is refused. freeze of data used as mutable is refused (freeze x.clone()), freeze of a plain value or of a record that counts as a value (every field a let of a value type or of such a record), which are already immutable, or merge of a value that is not isolated is refused, and a join of an isolated value with data that is not isolated needs every arm isolated or fresh. freeze takes a fresh region: a literal over locals is refused, so build the value in a function that returns it (freeze Pool.build()). An isolated local that an enclosing for iterates is held by the loop, so it is not moved as a message or factory argument inside the loop: send it after the loop. A local an enclosing loop relies on as fresh needs every path to the end of each lap, continue and the back edges of outer loops included, to assign it a fresh value nothing has read. A unique argument is a clean input only when its type is closed: a call given one whose type holds a plain record, array, union, function value or interface value is not a clean call. A value crosses to another thread (a send or spawn argument, a reply, a failed send’s hand-back) only as the whole of its region: a fresh expression, an isolated variable or an owned unique or linear value of a closed type. One whose type holds a plain part is refused, naming the part: declare it isolated, pass a fresh value, or consume the value where it is. Declare the local as isolated T, or pass a copy.

E3201 — semanticIsolatedCallOpensTwoRegions

Section titled “E3201 — semanticIsolatedCallOpensTwoRegions”

One call or statement opens a second region, or mixes in mutable data of the current one. A statement opens one isolated value, so reaching through two isolated values is refused: open one with modify, or split the statement. A call into an isolated region, and a store into one, takes values, immutable data or isolated data, never mutable data of the region outside it. A call that hands back mutable data of the region it opens is refused unless the same statement consumes the result: a comparison, a for loop over it, or a call whose other inputs and result are values (.count()). Use it inside a modify block otherwise. Reported at the offending value. Inside an acquire block a statement reaches one acquired state, because two names of one block may be one service: bind a value read from one state in its own statement first. While a modify or acquire block is open, an isolated value of a linear type from outside it cannot be moved into a parameter the callee keeps and that is not isolated, because it would become part of the open region: move it into an isolated parameter or slot, send it, or merge it. The receiver of a consuming self method is such a parameter when the method stores, returns or passes self on, and a finalizer that only reads self and ends in destruct self is accepted. The value stays outside the block through a local it is moved into, the isolated result of a call it is moved into, and the value a failed send hands back.

A mutable value leaves the region a modify block, or the one statement that opens an isolated value, has open. What leaves by return, by throw or into an outer variable must be a value, immutable data, or a fresh isolated value. A mutable isolated parameter is by reference: the callee may open, swap or replace it, and lend it on to another mutable isolated parameter (its own method’s recursion included), but never move it out, alias it, store it or pass it to an isolated parameter, because the caller’s variable would then name a region another owner holds. An acquire block holds the same line: a mutable value cannot leave it, and the name of an acquired state cannot be bound, returned, stored, moved into an isolated parameter or a spawn, or sent through async, because the service keeps its state. A call that opens a region and answers mutable data of it is judged where its result leaves the statement: a number read out of the result is accepted, binding, returning or storing the result is refused. A Reply taken out of an acquired state cannot outlive the statement that opens the state.

The variable that names an open value is reassigned inside its own modify block. Only the region’s contents are writable there; the slot holding the opened value is not. Write the contents, or leave the block before replacing the slot (swap takes a region out of a slot).

E3204 — semanticOuterDataWrittenInWindow

Section titled “E3204 — semanticOuterDataWrittenInWindow”

An outer var is reassigned while a modify block is open. Inside the block only block locals, objects created in the block and outer vars holding a number, bool, enum, payload-free union, String or Character are writable. An outer var holding anything else (a record, an isolated value, immutable data, a linear or unique value, a service handle, a union with a payload, a function or interface value, a value of an opaque type, a container) is read-only. The message names what the var holds. Reassign it before or after the block.

A modify block, an acquire block, or the one statement that opens an isolated value (a call that passes an isolated value in an unmarked position, as receiver or argument, opens it for that call) waits for another party while the region is open: an await of a coroutine or of a message reply, awaitAny, an acquire, a runtime park such as Scheduler.quiesce, or a call to a function that may wait (it awaits a reply from a service, or reaches one of those) or may yield (it awaits a coroutine, directly or through what it calls). Another coroutine could run while the region is open. Both facts are inferred from the bodies with no marker, and the message names the chain. Await or call before or after the block. A callee that only reads, writes or sleeps is accepted.

E3206 — semanticParamNeedsBothCapabilities

Section titled “E3206 — semanticParamNeedsBothCapabilities”

An unmarked parameter is used as mutable and as immutable. A body that writes through the parameter, stores it, or passes it to a mutable parameter needs it mutable, and one that sends it or passes it to an immutable parameter needs it frozen; no argument is both. The message names a use of each kind. Reported at the parameter. Pass a clone() where the other capability is needed, or split the function.

E3207 — semanticArgumentCapabilityRefused

Section titled “E3207 — semanticArgumentCapabilityRefused”

An argument’s capability is refused by the parameter it is passed to. A mutable argument at an immutable parameter is refused (freeze it first); an immutable or read-only argument at a parameter the callee writes or marks mutable is refused, naming the use that needs it writable; an isolated argument to an async call is taken only by an isolated parameter, which moves it; and while a modify block is open its read-only outer data cannot go to a parameter that needs writable data, and neither can the root that holds a unique value an arm or for body lends out of it. Constant data (a constant let, a b"..." literal) is immutable: handing it to a parameter the callee writes or stores into a plain place is refused ('grow' writes 'name' (line 5: `name.push(100)`); 'Name' is immutable), and so is writing through it ('push' needs a writable receiver; 'name' is immutable), including through a var bound to a literal. A Map key and a Set element are immutable slots, so a fresh record or array there needs freeze. A union parameter is judged like a record parameter, and so is a parameter that is only passed on to a callee that stores or writes it, an interface-typed one included. A parameter a record is built from takes no read-only argument (data an open modify block pauses, or a read-only result), and takes a frozen one only while nothing writes through the record built from it. The element an iterator hands out of a frozen collection parameter is frozen, so a callee that writes it is refused; a generic body that keeps its type parameter in a frozen slot (a Set element, a Map key) takes frozen arguments at every instantiation, so a record or array that something may write is refused there; and a closure that returns constant or module let data returns immutable data, so writing through its result is refused. Reported at the argument. Pass data of the capability the parameter needs, a clone() or a freeze.

A call’s result is judged by the arguments at the parameters some return path comes from, and those arguments disagree: one is mutable and another immutable (pick(a, b) returning a or b). All mutable gives a mutable result, all immutable an immutable one (read-only when some return path is not a parameter’s data), any read-only argument a read-only one; a mix of mutable and immutable has no capability to give the result. Reported at the call. Pass arguments of one capability.

A return does not fit the capability the function declares for its result. A mutable or read-only value cannot be returned as immutable (freeze it), an isolated value cannot be returned as a plain result (return merge x, or declare the result isolated), an immutable value needs a result declared immutable, and a result declared mutable cannot be a parameter’s data. Constant data (a constant let, a b"..." literal) and an immutable field read are immutable, so an unmarked result that returns one is refused: declare the result immutable. Reported at the return.

E3210 — semanticCapabilityConversionRefused

Section titled “E3210 — semanticCapabilityConversionRefused”

A function value or a conformer does more than the boundary it crosses declares. A function type and an interface requirement are read-only and never wait or yield unless they say otherwise, so a function value converted to a function-type alias, or a conformer’s method, is refused when it writes a parameter or its receiver the boundary does not declare mutable (mutable self for the receiver), writes data it captured where the alias does not declare mutates captures, may wait or yield, or does not declare the result capability (returns isolated, returns immutable) the boundary does. A closure that writes what it captured, or builds a record from it, is inferred to mutate its captures, so it converts only to a function type that declares mutates captures. A conformer whose result holds data from its receiver needs mutable self on the requirement. A closure that returns constant or module let data returns immutable data, so it converts only to a function type that declares returns immutable. Reported at the conversion, or at the name of the conforming method. Declare the capability on the boundary, or change the body to keep to it.

E3211 — semanticMutableFunctionConversionRefused

Section titled “E3211 — semanticMutableFunctionConversionRefused”

A function value whose type declares mutates captures is called through data that is not writable. Such a value may write what it captured, so it cannot be called through immutable or read-only data: not on frozen data anywhere, and not inside an open modify block when the value was returned from, read out of or stored in the data the block holds. Reported at the call. Call it through writable data.

The promise of an async call that was given mutable data is used for more than waiting. The coroutine still holds the caller’s data, so the promise is tied: it lives in a local, is awaited or cancelled on every path out of the function, and is never returned, stored in a field or container, captured, sent, or passed to a parameter the callee keeps. A path that leaves it unawaited and uncancelled is refused at that exit. .cancel() waits for the coroutine to finish. Await or cancel it before the function returns. Reported once the program has no other error.

A promise held in a local is dropped. A promise is consumed on every path out of its scope: awaited, cancelled with .cancel(), stored, returned, or passed to a parameter that takes it. Refused: leaving the scope without one of those, overwriting the variable, discarding the promise with _ =, and leaving the function on a path that does none. A promise inside a container or a field is cancelled when its holder is dropped. await it, call .cancel() on it, store it or return it. Reported once the program has no other error.

A unique value is copied or given a second name. A type declared is unique, or holding a unique field, or a union with a unique payload, is never cloned, so clone() is refused; the OS handle types (TcpClient, TcpListener, TlsStream, TlsListener, HttpServer, StreamingSubprocess, SharedSegment, and every type holding one) are unique, so they are never cloned either. A unique value read out of a field, an element, a for loop variable or a tuple destructure cannot be bound, passed to a parameter that keeps it, or given elsewhere, because the field or element goes on owning it and a unique value has one name. An element a call such as get hands back is read the same way: show(items.get(0)) lends it for the call, and let t = items.get(0) is refused. Move it out with pop, remove, removeFirst or Slot.take, swap it out of an isolated field, or read what you need from it where it stands. A message argument or spawn factory argument is handed to another green thread, so a unique value there must be the sender’s to give: one read from a field or an element, lent by a loop, a tuple or a match, or borrowed through a by-reference parameter is refused. A match over a unique union lends it to its arms, so the variable that holds the matched union (its name, the record whose field is matched, or an operand of a cond scrutinee) is not moved, copied, stored, captured or passed to a parameter that keeps it inside an arm. Do that before or after the match; an arm may still read the union through a parameter the callee only reads.

A type argument breaks a bound on a generic type’s type parameter. where T is sendable takes a value, a service handle or an immutable record, and refuses a plain record (the caller keeps sharing it) and a unique type (its values move; bound the parameter with isolated instead). where T is isolated takes a value, a service handle or a unique type. Every instantiation of the generic type is checked, and so are the types of its fields. A function’s or an extension’s where clause cannot spell either bound; they belong to a generic type’s own where clause. Reported at the instantiation.

E3216 — semanticServiceStateHoldsAPromise

Section titled “E3216 — semanticServiceStateHoldsAPromise”

A service type’s state can hold a promise. A field of a service type that is a Promise, an array of promises, or a record or union holding one is refused, reported at the spawn that makes the type a service and naming the field. A service’s state is run by whichever green thread takes its next message, and a coroutine belongs to the strand that started it, so a promise kept in the state could be awaited or dropped by a strand that does not own its coroutine. await the promise, or .cancel() it, before the message or factory returns, and keep its result in the field.

A service’s message parameter, message reply or factory parameter carries data with no capability word. A message hands its arguments to another green thread and its reply to the thread that awaits it, so a record, a union carrying data, an array or an interface value that crosses must be owned by one side or read-only on both. Reported at the spawn that makes the type a service, naming the parameter or message; only the factory that spawn names is judged. Numbers, bool, String, Character, enums, unions with no data, service handles, SharedValue cells and a unique value need no word. Write isolated to give the value away, built for this one send, or immutable to share it frozen (freeze x.clone()). Four kinds of value cannot cross a message whatever word is written, and are refused by this code too: a Promise or any type that can hold one (its awaiter owns it, and its coroutine belongs to the strand that started it), a function value (a closure record that owns what it captures), an opaque type parameter (its layout is not known at the send) and an OS handle bound to a thread, such as a MachinePin. await the promise and send its result, send the scalar the value is derived from, or drop the parameter.

Unary - is applied to a value of a full-width unsigned alias (int(0 to u64.max), which Count, ElementIndex and BytePos are). Such an alias holds 0 to u64.max, so the negation of any value above 0 is outside it. Write a deliberately wrapping negation over a bits(64) typealias, or convert the value to a signed typealias first with as.

E3219 — semanticUnusedUnexportedDeclaration

Section titled “E3219 — semanticUnusedUnexportedDeclaration”

An unmarked top-level function, let, type, enum, union or interface that nothing live in its directory’s subtree names. A declaration is live when code that is not itself an unmarked declaration names it (an export or public declaration, main, a test, a method) or a live unmarked declaration does, so declarations that only name each other, or a function that only calls itself, are all reported. A name spelled in a branch of #if the target excludes counts as a use. Delete the declaration, or use it. An unused typealias is E3062. A lint rule: maxon lint, maxon spec-test and the MCP check tool report it once the program has no other error, and maxon build, execute, run and test compile past it.

The initializer of a module-level let or a static let calls a function. Such a let is image data: its value is decided by the program text, laid down before main runs, and read as one copy by every function and thread, so nothing runs to build it. Write a literal instead: a number, a string, a b"…" literal, an enum case, an array, map or tuple literal, Type from [...], another constant let, or, in a static let, a record literal of the declaring type. A value that needs a call to build is built where it is used, by a function that returns it, and a copy that must be changed is .clone()d from the constant where it is used. The body of a closure literal is not part of the initializer, since it runs only when the closure is called; a call that receives the closure is.

A message or a spawn factory may wait on another party while it holds its own service. A message runs to its end holding its service, and the service takes no other message meanwhile, so a message that waits can wait for ever on a service that waits for it. Waiting is an await of a message reply or of a promise whose coroutine the compiler cannot see, awaitAny, a send with a positive sendTimeout:, an acquire, the spawn of a throwing factory, and a runtime park such as Scheduler.quiesce or CownTorture.violations; a message that calls a function that waits, or starts a coroutine that waits, waits too. The message names the chain from the message to the wait. main, a test body and a coroutine hold no service and may wait. Send the request with the service’s handle and handle the reply in another message, passing the asker’s handle with the request or answering through a Reply; send with sendTimeout: 0, which fails mailboxFull instead of waiting; or make the wait from main.

A deferred reply is written or used where the service that holds it could not answer it exactly once. reply.later() takes the reply of the message it is written in: it is the whole initializer of a let at the top level of the message’s body, written once, in a message of a service that returns a value and declares throws ReplyStopped, and not in a generic service or in a message that returns an interface value. A message that defers answers through its Reply alone, so its own return carries no value, and it is called only by a send through the service’s handle. A Reply is answered through the local or parameter that holds it, so take it out of a field first (let pending = try self.waiting.pop() otherwise return). A Reply never leaves the code of the service that holds it: a function declares no result whose type can hold one, an async call takes no parameter that can hold one, no closure captures one and no value that can hold one is widened to an interface type, because a function value and an interface value carry what they hold to whatever code receives them. Pass the answer’s inputs as message arguments, and answer the Reply in the message that holds it.

A linear value is not consumed exactly once. A type with a finalizer, a method that contains destruct self and takes consuming self, is linear, and so is a union with a linear payload. A linear value is consumed on every path out of its scope, throws, early returns and propagating trys included, by a finalizer call or by being moved on to a function that takes it, a return, a throw or a message. It is refused dropped, overwritten, rebound while live, discarded with let _ = r, left in a temporary nobody consumes, or live across a wait (an await, a send with a sendTimeout:, or a call that waits), because a wait may never end. A variable of a linear union that holds a case carrying no linear value (Maybe.nothing) on every path to the point owes nothing there, so assigning it or leaving it live is not a drop. Consume it before the exit or the wait: call its finalizer, or hand it to code that does.

A linear value is used where it cannot be consumed exactly once. It lives only in locals, parameters, message arguments and the arguments of a spawn whose factory cannot throw: a field, a container or other type argument, a tuple item, a closure capture, a promise payload, a message reply, a union stored in a field, an argument of an async call, the result of an async call, an argument of an interface or function value call and an argument of a spawn whose factory may throw (it starts no service when it fails, and drops the value) are refused. A linear value lent to code that does not own it (a parameter of a function that does not take it, or self of a method that does not take consuming self) is not consumed there, returned or built into a union. consuming self belongs to a method of a type that declares a finalizer, and destruct self is written in a method that takes consuming self, on a type that holds fields. A match over a union with a linear payload binds the payload in every arm that covers its case and consumes it there, and a default arm cannot cover such a case. Carry the value in a local or a message argument, and consume it where it is received.

An entry function declares parameters: a program’s main, or any exported or public function of a .maxproj or .maxtasks, each of which is a target or task and is checked on every build or run of that file, so maxon build app is refused when another export helper takes a parameter. An entry is called with no arguments, so a parameter with a default value is refused too: function main(code ExitCode = 0). Remove the parameters and obtain the values another way; a program reads its command-line arguments with CommandLine.args(). In a .maxproj or .maxtasks, a function that is a helper drops its export (or public) instead.

E3226 — semanticTupleCastChangesCapability

Section titled “E3226 — semanticTupleCastChangesCapability”

A tuple cast gives an element a different capability: (Box, Wide) as (immutable Box, Wide), or the reverse, at any nesting depth. An as neither freezes nor thaws, so each element keeps the capability it has; the message names the element’s position and both types. An immutable written on an element of a value type (a number, bool, an enum, String, or a record that counts as a value) means the type itself, so (immutable P, W) is the type (P, W) and casts like it. For an immutable target element, build the tuple from a frozen element (freeze x, or freeze x.clone() to keep x writable); for an unmarked one, build it from a clone() of the element.

IR generation.

A member is used that its type does not have: a method the type does not declare, a method a conditional extension gives only to types meeting its where clause, or allCases on a union. The message names the type as source would qualify it, so the library’s Range in a program declaring its own is stdlib.Range. Correct the member’s name, or call it on a type that has it.

a type definition contains a reference cycle – it transitively contains itself through struct fields, union associated values, or container element types. Maxon’s ownership model requires acyclic type graphs for deterministic destruction, so recursive type references are rejected. Emitted by the type-cycle check after type resolution. A service handle is an edge of the same graph, from the handle to the service it addresses, and from an interface handle to each service that implements the interface. A service whose state reaches a handle to itself, directly, through the handles of other services, or through an interface handle, is never freed, because the handle counts as a holder of the service; the message names the cycle. A function value holds whatever its closure captured, so a service state that holds one reaches the handle of every service some closure in the program captures. An interface value holds whichever conformer the program built, and a generic instance built at a type parameter (a Wrap with T that hands out a Gen with T as a Sink) is written nowhere in the source, so a service state that holds that interface reaches every service handle. Build the conformer at a concrete type, or pass the handle with each message instead of keeping it in a field, or give the services distinct types. A handle a message carries is not state.

E4015 — declarationTakesCompilerOwnedName

Section titled “E4015 — declarationTakesCompilerOwnedName”

a declaration in the source took a function name that belongs to the compiler. Reachable only from stdlib/Builtins.maxon, the one file whose declarations may carry the reserved __ prefix (E2051’s exemption for that file): the name is declarable THERE, so what E2051 refuses is not what this refuses. ONE rule, and the compiler can enforce it at the two places it USES such a name, since the full roster of names it owns is not enumerable (the dynamic families are built from the program’s own type names). (1) The name is also a function the compiler EMITS into this program, and a program cannot hold two functions of one name. Detected where the collision first becomes visible – a name index over the module’s functions – and told apart from an installer that ran twice by PROVENANCE, since a synthesized function carries no sourceFilePath and a parsed one always does. (2) The name is one the reachability prune ROOTS unconditionally, so the declaration is resurrected into a program that installs no runtime under that name – with no body, because the pre-elimination passes skipped the one they were told was unreachable. Refused whether or not the compiler emits its own copy HERE, so the rule is about the name and not about which runtime floor a given program happens to carry.

the error enum a builtin runtime family throws is DECLARED in stdlib/Builtins.maxon (__ManagedMemoryError, __ManagedFileError, __ManagedDirectoryError), and this checkout’s declaration disagrees with the ordinals the compiler’s runtime transcribes as literals – either the enum is not declared at all (the module was not loaded), or a case it declares sits at a different position than the runtime throws it at. The case ORDER is the wire format: a throwing runtime returns ordinal + bias as its error flag and a handler arm is selected from it, so a disagreement routes every handler arm to the wrong case SILENTLY. Reported rather than panicked because the declaration is now a property of a FILE on disk: stdlib/Builtins.maxon may be edited, while the two families the compiler still SYNTHESIZES (__ArrayError, __DivisionByZeroError) keep the panic, since only the compiler’s own source can make those disagree.

Native machine code emission.

Register pressure: a value set live across a call, an idiv, or a loop genuinely needs more registers than the target has, after the cold-spill splitter has moved every idle value out and rematerialized every constant. Only the programmer can resolve a hot overflow, so the compiler refuses rather than guessing.

E5003 — codeEmitterCoverageNeedsDebugInfo

Section titled “E5003 — codeEmitterCoverageNeedsDebugInfo”

--coverage was combined with --no-debug-info. The instrumented binary’s counters are anonymous numbers: what each one counts lives in the .mxdbg sidecar’s coverage-point table, which --no-debug-info suppresses. Emitting them anyway would produce a .mxcov data file nothing could ever interpret, so the combination is refused rather than silently dropping either half.

A chain of functions compiled without a green-thread stack check could overflow the margin below the stack limit. A function with no prologue check runs inside that margin, so every chain of such functions – inlined callees included – must fit it, and none may reach itself, directly or through a call through a function pointer (priced at the deepest function whose address is taken). Proven once per build over the finished code, on a target with green threads. Reported at the function that heads the chain, or program-wide for one no source declares. Give a function in the chain a stack check, or break the recursion.

A runtime function takes an exclusive lock word it already holds, or takes the runtime’s locks against their order. An exclusive runtime lock such as __sched_lock is not recursive, so the second take waits on the first for ever. The runtime’s locks are taken in one order: __sched_lock, then the allocator’s __slab_raw_row_lock, then its __slab_heap_lock. A thread that holds a later one and takes an earlier one waits for ever on a thread that took them in order. Proven once per build over the runtime the compiler emits, on every target but wasm32-wasi, whose one thread drops the locks: along every path on which a function may hold a global exclusive lock or one of the allocator’s two, no call may reach a function that takes it again or takes a lock that comes before it in that order, directly or through further calls, in the runtime or in the program. A call through a function pointer counts as reaching every function whose address is taken, by an op or by an .rdata slot, except the entry points only the OS enters. A function that returns holding a lock passes the hold to its callers. Reported program-wide, naming the holding function, the call and the chain to the second take, and for an inverted take the order it breaks. Pass the held state down instead of taking the lock twice: give the inner function a form that expects the lock held. Take the earlier lock first, or release the later one before taking it. What this does not cover: calls the backend inserts after the lock marks are expanded, code hand-assembled into the image, a lock word that is neither one global nor one of the allocator’s (a cown’s or a stack pool’s), and a build whose function names collide, which E4015 reports and which skips the check.

A runtime function that requires an exclusive lock held is called where the lock may be free. A function states the requirement when the runtime builds it: the _held forms of the doors that otherwise take the lock themselves, and the functions that only ever run inside it. Along every path to a call of such a function the lock must be held, in a caller that takes no lock of its own as in one that does; a lock a callee returns holding on every path counts as held, and one it returns holding on only some paths as possibly held. A call through a function pointer counts as reaching every function whose address is taken, so it must hold every lock any of them requires. A function with the requirement starts with the lock held, so its own calls are checked against E5005 as well, and it must still hold the lock at every return, because its callers go on as though it did. A function releases only a lock it holds on every path, one it took itself or one it requires, so no callee frees a lock its caller holds. Proven in the same pass as E5005. Reported program-wide, naming the caller and the callee, the function that returns without its lock, or the function that releases a lock it may not hold. Take the lock before the call on every path that reaches it, or call the form of the callee that takes it. What this does not cover, beyond E5005’s exclusions: a lock that a function called through a function pointer returns holding.

Executable formatting and linking.

The build could not replace the previous output at this path. A build writes its output into a .staging-<hex> directory beside it and publishes it by renaming the previous output aside, then renaming the new one into place; renaming a running program is permitted, so a program still running from the output is replaced as any other. The message names the road that refused, and except for the last one below it states that the previous binary is still in place, so a ;-chained build-then-test runs the stale one:

  • The output is read-only. Clear its read-only flag and build again.
  • The staging directory could not be created, or an image an interrupted build left in it could not be removed. Check that the output’s directory is writable and that no file occupies the staging directory’s path.
  • The previous output could not be renamed aside, or the new build could not be renamed into place and the previous output was put back. Something holds the file or its directory open in a way that forbids a rename: a program reading, scanning or debugging it.
  • A compiler rebuilding its OWN running image could not rename it, or the older .previous it could neither delete nor rename, out of the way. The message names that file.
  • The new build could not be renamed into place and the previous output could not be put back. The output path holds nothing; the message names where the previous output and the new build are, and moving either to the output path by hand restores it.

The backend reported no failure, yet nothing exists at the staged output path after the write. The staged path is emptied before the write, so its ABSENCE afterwards means the writer did not produce it – a swallowed IO failure. A build that cannot say where its output is must not report success. The message names the staged path it checked and the output it was for.

The directory the output goes in does not exist and could not be created. The backend writes the FILE and does not create the path to it, so without this the build fails at the write and answers E6003 – which names the missing OUTPUT and says the write failed, sending the reader to look for an IO fault that is not there. Every project whose output lives in a gitignored directory meets this on its first build in a fresh clone.

A wasm32-wasi build could not turn its core module into a WASI Preview2 component. The compiler wraps the module with wasm-tools and the WASI WIT package, which it looks for as vendor/wasm-tools/ and vendor/wasi-wit/ in the working directory and the directories above it; a Maxon source checkout stages both with scripts/fetch-vendor.sh, and an installed compiler does not include them. A missing tool is refused before anything is compiled. The message names what is missing and where it was looked for, or which wasm-tools step failed and what it printed.

A member is used that the program plainly DECLARES, but the compiler’s whole-program declaration index does not carry it – the declaration sweep read the declaration’s head, failed to read its return type, and dropped the signature. That tolerance is deliberate and it is for MALFORMED SOURCE: a return type the sweep cannot read is the real parse’s to report, with a position, and a sweep that could veto would reject a correct program the moment it failed to recognize something the parser accepts. What it must NOT absorb is a failure the real parse never re-raises – a return type the DEFERRED whole-program folds could not canonicalize while the registries those folds fill were still being filled. The declaration then simply stops existing, and the first thing to notice is a USE of it, refused as though nothing had been written. A method inside an extension returning a tuple whose element is a ranged alias declared by a SIBLING extension in another file is the shape that has reached this: a walk that folded the method’s file first left the element unresolved and the method vanished, reported as E2015 at the CALL. This code is what such a program says: the member IS declared, at the position named, and the index lost it. It is a COMPILER BUG wherever it fires. The position is the USE, because that is where the compile stops; the declaration’s own file, line and column are named in the message, because that is what has to be read to fix it.

E9003 — internalDeclarationTheSweepMissed

Section titled “E9003 — internalDeclarationTheSweepMissed”

A function declaration is missing from the whole-program declaration index. This is a compiler bug. Before any file is parsed in full, the compiler sweeps every file for the functions it declares, so that a call can be typed from a declaration in a file not yet parsed. The full parse of the declaration at this position found a function the sweep did not record, and a call to it would be compiled as a call to a function nobody declared. The fault is the compiler’s: report it to the Maxon project with the source that produces it.