Errors

Compile errors

Each message below comes from the spec. The spec names the message, and the compiler must print it. Each row links to its section of the reference.

83 messages, listed by section.

MessageScenarioSection
tabs are not allowed; indent with spacesA tab in indentation is an error4. Lexical rules
inconsistent indentationIndentation must match an open block level4. Lexical rules
unterminated stringA string must end on the same line4. Lexical rules
unknown escape sequenceAn unknown escape is an error4. Lexical rules
x is an immutable binding and cannot be reassigned; declare it with mut x = ... to allow reassignmentA plain assignment makes an immutable binding7. Bindings
x is already declared in this scopeA name cannot be declared mut twice in one scope7. Bindings
x is an immutable binding and cannot be reassigned; declare it with mut x = ... to allow reassignmentAn inner plain assignment cannot reassign a visible immutable name7. Bindings
a declaration cannot have a trailing if; write it as an if: blockA declaration cannot end with if7. Bindings
...rest must be the last name in a patternA rest name must be last8. Destructuring
a pattern can only hold names, like {name, age: years}A pattern holds only names8. Destructuring
x is already declared in this scopeA pattern binds only new names8. Destructuring
destructuring at the top level of a file with @wasm or @worker is not supported yet; move it into a functionA pattern at the top level of a file with @wasm or @worker is an error8. Destructuring
destructuring is not supported in @wasm functionsA pattern in a @wasm function is an error8. Destructuring
a mut parameter cannot have a default value yetA mut parameter cannot have a default value9. Functions
cannot pass immutable t to a mut parameter of f; declare it with mutThe argument must be a mutable binding10. Mutable parameters
argument 1 of f is mut, so it must be the name of a mutable bindingThe argument must be a plain name10. Mutable parameters
mut parameters are not allowed on @worker functionsA mut parameter is not allowed on a @worker function10. Mutable parameters
mut parameters are not allowed on class methodsA mut parameter is not allowed on a class method10. Mutable parameters
h is exported, so it cannot take mut parameters; other modules cannot see themAn exported function cannot take a mut parameter10. Mutable parameters
total is a top-level binding shared with the implementation module and cannot be changed from main-thread code; move the change into a functionMain-thread code cannot change a shared binding11. Shared bindings in worker files
q is mutable top-level state, and each worker in a pool keeps its own copy; make it immutable, or remove poolA file with a pool cannot declare a top-level mut binding11. Shared bindings in worker files
requires and ensures must come at the top of a function body, before other statementsContract lines come first in a body12. Contracts
a parameter cannot be named result when the function has ensures; result is the return value thereA function with ensures cannot have a parameter named result12. Contracts
requires and ensures are not supported on @memo, @worker, or streaming functions yetContracts are not allowed on @memo, @worker, or streaming functions12. Contracts
requires and ensures are not supported in @wasm functions yetContracts are not allowed in a @wasm function12. Contracts
a test block must be at the top level of the fileA test block is allowed only at the top level13. Tests and assertions
typed hole: write the value here, _ is a placeholderAn underscore marks a value not yet written14. Typed holes, match, and comprehensions
a binding cannot appear inside an | patternAn alternative cannot bind a name14. Typed holes, match, and comprehensions
this match may not handle every value; add a last arm _ => ... (or a name) to catch the restA match must handle every value14. Typed holes, match, and comprehensions
else => must be the last armelse must be the last arm14. Typed holes, match, and comprehensions
this match: needs a last arm else => ..., so that every case is handledA match without a subject needs an else arm14. Typed holes, match, and comprehensions
a comprehension must start with a for clauseA comprehension must start with a for clause14. Typed holes, match, and comprehensions
pin doesn't use == or ===. Write is to test equalityThe symbol == is an error15. Ranges, values, and operators
pin has no !=; write isnt to mean not equalThe symbol != is an error15. Ranges, values, and operators
pin has no &&; write and to join two conditionsThe symbol && is an error15. Ranges, values, and operators
pin doesn't use ||. Write or to join two conditionsThe symbol || is an error15. Ranges, values, and operators
pin has no elif. Write else if for another conditionelif is an error16. Control flow
break is only allowed inside a loopbreak outside a loop is an error16. Control flow
a try needs a catch or a finally blocktry needs catch or finally17. Errors
positional arguments must come before labelled onesPositional arguments come before labelled ones19. Labelled arguments
connect is given more than onceA label cannot name a parameter twice19. Labelled arguments
connect has no parameter named timeoutA label must name a parameter19. Labelled arguments
connect needs a value for hostA parameter without a default needs a value19. Labelled arguments
labelled arguments only work when calling a function by its nameLabels work only when the callee is a name19. Labelled arguments
a spread cannot be mixed with labelled argumentsA spread cannot be mixed with labels19. Labelled arguments
type number is not allowed in @wasm functions; use int, float, or booleanwasm parameters and results use only int, float, and boolean20. Types
parameter n needs an int, float, or boolean annotationEvery wasm parameter needs an int, float, or boolean annotation20. Types
@wasm f needs a return type annotationA wasm function needs a return type20. Types
unknown decorator @foo on function fAn unknown decorator is an error21. Decorators
@wasm takes no options, but x was givenOnly @worker takes options21. Decorators
unknown option size on @worker; the only option is poolpool is the only @worker option21. Decorators
@memo cannot be combined with @wasm yet@memo cannot be combined with @wasm21. Decorators
@memo cannot be combined with @worker yet@memo cannot be combined with @worker21. Decorators
arithmetic needs int or float operandsArithmetic needs int or float operands22. WebAssembly (@wasm)
operands must have the same type, got int and floatBoth operands must have the same type22. WebAssembly (@wasm)
% needs int operands% needs int operands22. WebAssembly (@wasm)
ordering needs int or float operandsOrdering needs int or float operands22. WebAssembly (@wasm)
and/or need boolean operandsand and or need boolean operands22. WebAssembly (@wasm)
** is not supported in @wasm functions** is not supported in wasm22. WebAssembly (@wasm)
g is not a @wasm function; @wasm code can only call other @wasm functionsOnly calls by name to other @wasm functions are allowed22. WebAssembly (@wasm)
unknown name n; @wasm functions can only use parameters, local bindings, and other @wasm functionsA name must be a parameter, a local binding, or a @wasm function22. WebAssembly (@wasm)
strings is not supported in @wasm functionsStrings, arrays, and objects are not allowed in wasm22. WebAssembly (@wasm)
loops over collections are not supported yet; use whileLoops over collections are not allowed in wasm22. WebAssembly (@wasm)
nested function g is not allowedA nested function is not allowed in wasm22. WebAssembly (@wasm)
expected boolean but got intA return value must match the return type22. WebAssembly (@wasm)
worker arguments must be an arrayWorker arguments must be an array24. Workers
pool must be a whole number from 1 to 32, not 40A pool size outside 1 to 32 is an error24. Workers
pool is given more than oncepool is given once24. Workers
every @worker function in one file must use the same pool sizeEvery worker function in one file has the same pool size24. Workers
mut parameters are not allowed on @worker functionsA @worker function cannot take a mut parameter24. Workers
transfer needs an ArrayBuffer or a typed arraytransfer needs a buffer25. Transfer
transfer(...) must be a direct argument or result of a @worker call, not nested in another valuetransfer must be a direct argument or a direct result25. Transfer
yield is only allowed in a @worker function, directly in its bodyyield is allowed only directly in a worker function body26. Streams
a streaming @worker function cannot be asyncA stream cannot be async26. Streams
a streaming @worker function ends with a plain return; it cannot return a valueA stream cannot return a value26. Streams
p needs at least one row that is matched, not only part rowsA regex block needs a row that is matched27. Regex blocks
a regex row needs a pattern and then a name, like \d+ digitsA row needs a pattern and then a name27. Regex blocks
<name> is not a part defined above itAn undefined part name is an error27. Regex blocks
matches "x", but the pattern rejects itmatches and rejects examples are checked at build time27. Regex blocks
unknown flag q; a regex block takes i, m, s, or uAn unknown flag is an error27. Regex blocks
the flag i is given twiceA flag can appear only once27. Regex blocks
uses lookaround, which the build check does not support yetLookaround is an error27. Regex blocks
a block after name = is written regex: or find:, not pattern:A block after a name must be regex or find27. Regex blocks