Diagnostics
This page explains how to read the compiler's error messages, and lists the codes with what they mean and where the rule is explained.
Reading a diagnostic
error[E_SEMANTIC]: function.argument:add@60:i64:string
source[semantic]:main.ab:60:61
--> main.ab:4:17
help: ...
error[CODE]names the kind of problem. Codes are stable: tests and tools
match on them, and so can you.
- For type, ownership and other semantic errors the code is
E_SEMANTIC,
and the first word of the message is a more precise dotted code (function.argument). The rest, separated by :, are details: here the callee add, the byte offset 60 of the argument, the expected type i64 and the actual type string.
source[phase]:file:begin:endlocates it as a range of byte offsets
in the file, for tools. The phase is parser, semantic, eval and so on. The --> line after it gives the same place as file:line:column (columns count characters, from 1); it is left out when the file can't be read, as for a generated module.
help:lines, when present, suggest a fix.context[...]lines add the module or declaration involved.- The last line counts the errors per phase:
LLVM compilation failed: 0 parser, 0 extension, 1 semantic, 0 IR, 1 total error(s); when every error is a failing # site's, compile-time evaluation failed: 1 error(s) (compile-time.md).
Types are written in their canonical spelling: int is i64, a nullable type is nullable:T, a function type is function:(i64)->i64, and a generic's instance is Box<i64> (its own body's type parameter is T). An expression whose type couldn't be worked out shows as unknown; such errors usually follow from an earlier one.
When several errors are reported, fix the first one and build again: later errors often follow from it.
Parser: E_PARSE_*
A parse error stops the build after the parser, so a file with one reports only its parse errors.
| Code | Message |
|---|---|
E_PARSE_EXPECTED_TOKEN | expected token X, found Y |
E_PARSE_EXPRESSION | expected an expression, found X |
E_PARSE_STATEMENT_SEPARATOR | expected a newline, ;, or } after statement |
E_PARSE_TOP_LEVEL_DECLARATION | expected a top-level declaration or compile expression: statements must be inside a function |
E_PARSE_NESTING | expressions and blocks are nested more than 2400 levels (each expression and each block counts one: about 1200 nested blocks), or an else if chain has more than 2500 links; the only error reported for the file (not a stack overflow) |
E_PARSE_PARAMETER_SEPARATOR, E_PARSE_ARGUMENT_SEPARATOR, E_PARSE_ARRAY_SEPARATOR | a missing , |
E_PARSE_UNCLOSED_DELIMITER | an unclosed (, [ or { |
E_PARSE_UNTERMINATED_COMMENT | a block comment reaches the end of the file with no matching */ |
E_PARSE_STRING_PART | a malformed string or template |
E_PARSE_INVALID_UTF8 | a quoted string contains a byte sequence that isn't UTF-8 |
E_PARSE_RAW_OPEN_LINE | the opening """ of a multiline raw string is followed by text on the same line |
E_PARSE_RAW_CLOSE_LINE | the closing """ of a multiline raw string doesn't stand on its own line |
E_PARSE_RAW_INDENT | a nonblank content line is indented less than the closing delimiter |
E_PARSE_RAW_UNTERMINATED | a raw string is missing the closing """ |
E_PARSE_EXTENSION_RECEIVER | an extension's receiver type isn't followed by .name (e.g. an unclosed array<int) |
E_PARSE_ELVIS | Kotlin's ?:: Abla writes it ?? (null-safe operators) |
E_PARSE_INVALID_ESCAPE | an unknown backslash escape in a string, a \x without 2 hex digits, or a \u that isn't a Unicode code point (language.md) |
E_PARSE_INTEGER_RANGE | an integer literal larger than 18446744073709551615, the largest u64 (up to that it keeps its bits; above 9223372036854775807 it is the int with those bits, which u64(...) reads as written) (language.md) |
E_PARSE_INVALID_HEX | a hexadecimal literal with no digit (0x, 0x_) |
E_PARSE_INVALID_OCTAL | an octal literal with an 8 or 9, or with no digit (0o) |
E_PARSE_ASSIGNMENT_TARGET | the left side of = can't be assigned (a ?. chain is not a place) |
E_PARSE_COMPOUND_ASSIGNMENT_TARGET | the left side of += etc. contains a call (language.md) |
E_PARSE_LOGICAL_ASSIGNMENT_TARGET | the left side of &&= or ||= is neither a name nor a field |
E_PARSE_TRAILING_LAMBDA_TARGET | a trailing lambda after something that can't be called |
E_PARSE_DISCARDED_LAMBDA | a bare lambda is used as a statement and its value is discarded. Call it, assign it, or use a control-flow block for statements intended to run immediately. |
E_PARSE_CAST_TYPE | as? isn't followed by a class name |
E_PARSE_LOOP_LABEL | break@ or continue@ isn't followed immediately by a label |
E_PARSE_PRIVATE_TARGET | private modifies a declaration. It can't modify an import, compile-time action or extend block. |
E_PARSE_CLASS_MEMBER | a class body contains something other than a method |
E_PARSE_DELEGATED_PARAMETER | by on a function's parameter, or on a constructor parameter that isn't val/var: only a class property is delegated (delegated properties) |
E_PARSE_RESOURCE_DECLARATION | resource before something other than class |
E_PARSE_ANNOTATION, E_PARSE_ANNOTATED_DECLARATION | a duplicate annotation, or one not followed by a declaration |
E_PARSE_DEFER_BODY, E_PARSE_REGION_BODY, E_PARSE_SUSPENDING_BODY | defer, region, generator, task or thread without a block |
E_PARSE_DECLARATION_BLOCK_* | a malformed declaration block |
E_PARSE_*_PROGRESS | the parser couldn't continue at that point; see the previous error |
A block with no closing brace reports E_PARSE_EXPECTED_TOKEN. Close the block with }.
fun main {
// error: E_PARSE_EXPECTED_TOKEN
// error: help: close the construct
A missing operand reports E_PARSE_EXPRESSION. Add the operand or remove the operator.
fun main: int = (1 +)
// error: E_PARSE_EXPRESSION
// error: help: write a value here
Two statements on one line need a separator.
fun main {
val first = 1 val second = 2
}
// error: E_PARSE_STATEMENT_SEPARATOR
// error: help: put the next statement on a new line
Put a call that runs when the program starts inside fun main.
println("hello")
// error: E_PARSE_TOP_LEVEL_DECLARATION
// error: help: put executable statements inside
Close a block comment with */, or use // for a single line.
/* comment
// error: E_PARSE_UNTERMINATED_COMMENT
// error: help: close the comment with
In a multiline raw string, put the opening and closing delimiters on their own lines. Here, text must move to the next line.
val message = """text
"""
// error: E_PARSE_RAW_OPEN_LINE
The closing delimiter can't follow text on a content line.
val message = """
text"""
// error: E_PARSE_RAW_CLOSE_LINE
Indent content at least as far as the closing delimiter. In this example, add another space before text or move the closing delimiter to the left.
val message = """
text
"""
// error: E_PARSE_RAW_INDENT
Add a closing delimiter to finish a raw string.
val message = """text
// error: E_PARSE_RAW_UNTERMINATED
For a byte that isn't text, write a byte escape such as \xFF in an ordinary string. For example, this command puts a literal invalid UTF-8 byte inside the quotes, so building invalid.ab reports E_PARSE_INVALID_UTF8.
printf 'fun main { val text = "\377" }\n' > invalid.ab
A bare lambda won't run by itself. Use an if or loop block for statements that should run immediately, or call the lambda as { 42 }().
fun main: int {
{ 42 }
0
}
// error: E_PARSE_DISCARDED_LAMBDA
Give a conditional cast a class name after as?.
fun main: int = 1 as? 2
// error: E_PARSE_CAST_TYPE
For an unlabeled break, write break. A labeled break must name an enclosing loop, as in break@outer.
fun main {
while (true) { break@ }
}
// error: E_PARSE_LOOP_LABEL
Remove private from an import. Use it on the declaration you want to hide.
private import "abla/io"
fun main {}
// error: E_PARSE_PRIVATE_TARGET
Names, calls and types
| Code | Meaning |
|---|---|
identifier:<name>@<offset> | no variable, parameter or declaration of that name is visible |
call.target:<name> | no function of that name |
function.arity:<f>, method.arity:<T>.<m>, constructor.arity | wrong number of arguments |
method.unknown:<T>.<m> | T has no method m (a help line names the standard module to import when one declares it, e.g. abla/text for string.trim) |
function.argument:<f>@<offset>:<expected>:<actual>, method.argument, constructor.argument | an argument of the wrong type; a help line says when the argument is a closure that changes its captures (mut:function:...: declare the parameter var g: FnMut(...) -> T) or consumes them (own g: FnOnce(...) -> T) |
function.result:<f>:<declared>:<actual>, method.result | the body's value doesn't match the declared result type (language.md) |
return.type@<offset>:<expected>:<found> | a return value doesn't match the result type. The help names the type to return and may suggest a conversion. A closure that changes its captures needs a FnMut(...) -> T result. |
member:<Type>.<name> | no such property or method; member:nullable:... means the receiver may be null |
safe-call.non-null:<T> | ?. on a value that is never null: use . (null-safe operators) |
null-default.non-null:<T> | ?? after a value that is never null, so the default is never used |
null-default.type:<T>:<U> | a ?? b where b's type isn't a's non-null type T (an integer literal is an int: write i32(0)) |
local.initializer:<name> | an initializer doesn't match the declared type |
integer.narrowing:<where>@<offset>:<expected>:<actual> | an int where a narrower integer is stored or passed (an argument, a declared local's initializer, an assignment, an array element or a result) that is not a literal that fits: convert it, e.g. u8(value) |
assignment.type:<name>@<offset> | an assigned value doesn't match the variable's type |
logical.assignment.bool, logical.assignment.target | &&= and ||= require a mutable Boolean local or ordinary Boolean field and a bool right-hand side |
assignment.immutable, global.immutable, field.immutable, member.immutable | assigning a val |
library.program-global:<name>@<offset> | standard-library code names a program's global val or var (modules) |
global.initialization-cycle:<a>-><b>->...<a> | top-level initializers that depend on each other, directly or through functions (language.md) |
local.duplicate, local.shadows-parameter, local.uninitialized-type, local.uninitialized-val | see values and variables |
symbol.duplicate:<name>@<offset>:<files> | two declarations with the same name and parameter types. When they are in two modules, a note: per module names the import that brings it in (once per pair of modules), and help: says how to keep them apart: alias one import, or remap one module to the other |
call.overload-ambiguous, call.overload-no-match | see overloads |
arithmetic.type@<offset>:<left>:<right>, bitwise.type, comparison.type, logical.type, unary.boolean | operand types that don't fit the operator (integers); <, <=, >, >= take numbers and strings only |
division.zero@<offset> | an integer divisor that is always zero (integers) |
string.interpolation:<type> | a value a template can't insert (strings) |
array.element-type, index.type, index.receiver | array literal and indexing errors |
append.*, truncate.size, clear.arity, filledArray.*, slice.* | array and string method errors (arrays) |
map.untyped, map.key-type, map.<method>.* | Map errors |
type.underlying, type.constructor-* | nominal type errors |
if.condition, while.condition, do-while.condition, for.source, range.bound-type | control-flow operands of the wrong type |
when.non-exhaustive, when.duplicate, when.else-last, when.else-duplicate, when.empty | see control flow |
break.outside-loop, continue.outside-loop, return.outside-function | control transfer outside its construct |
E_NAMED_ARGUMENT_UNKNOWN, _DUPLICATE, _ORDER, _REQUIRED, _TARGET, _ARITY | named-argument errors (functions) |
call.not-function:<name> | a call by a name that a local or field holds, not a function, while the top-level name is a function value: rename one |
E_PACKAGE_SUBPATH_INVALID | a package subpath that is absolute, has an empty, ., .. or .git part, or goes through a symbolic link (packages.md) |
E_PACKAGE_SUBPATH_MISSING | no module at that subpath of the package; it says where it looked |
E_PACKAGE_SUBPATH_PRIVATE | the package has [exports], and that subpath isn't in it |
E_NAMED_ARGUMENT_HIDDEN | a default left out of a named call calls a constructor or foreign function that a local or function-typed field in the caller hides, and its type has a type parameter no earlier parameter gives: pass the argument |
E_NAMED_ARGUMENT_DELEGATED | a constructor argument names a delegated property, whose delegate comes from its by (delegated properties) |
field.extension-owner:<T> | an extension field on a type with no object to hold it: a scalar, string, array, nominal type or interface (extension fields) |
field.extension-shadows:<T>.<f> | an extension field named like a field or method of its class |
field.extension-untyped:<T>.<f>, field.extension-default:<T>.<f>, field.extension-delegate:<T>.<f> | an extension field without a type, without a default, or with a delegate |
field.extension-type:<T>.<f>:<expected>:<actual> | an extension field's default of another type |
field.extension-resource:<T>.<f> | an affine extension field (a resource, Shared, Weak, Mutex) on a class that isn't affine |
field.extension-reassigned:<T>.<f> | a second assignment of an extension val (at run time; E_EVAL_EXTENSION_REASSIGNED under #) |
name.private:<name>:<module>, E_NAME_PRIVATE | another module's private declaration used here (through an alias: E_NAME_PRIVATE) (modules) |
private.export:<f> | @export on a private function |
export.local-unbound:<symbol> | an @exportLocal function whose name no extern:"c" declaration of the build declares, so nothing could call it (language.md) |
extern.export-mismatch:<symbol>@<offset>:<what>:<extern file>:<export file>@<offset> | an extern:"c" declaration and an @export of the same symbol in one program with different signatures; <what> is parameters:<declared>:<defined>, parameter<n>:<declared>:<defined> or result:<declared>:<defined> (language.md) |
interface.missing-member:<I>.<m>:<C> | a class conforms to an interface, and no method, extension function or default body of the interface answers its member m (interfaces) |
interface.member-signature:<I>.<m>:<C>:<type> | the class's method (or extension function) m takes other parameter types or modes, or returns another type, than the interface member's <type> |
interface.member-untyped:<I>.<m> | an interface member without a body and without a result type |
interface.unknown:<C>:<name>, interface.duplicate:<C>:<I> | a class's conformance list (or an extend) names something that isn't an interface, or an interface the class already conforms to |
interface.extend-unknown:<name> | extend names something that isn't a class |
interface.resource-into-plain:<I>:<C> | a resource class conforming to a plain interface, whose values copy freely |
interface.cast:<from>:<to> | x as? C where C doesn't conform to x's interface, so the cast could never succeed |
interface.inheritance-cycle:<I> | an interface extending itself, directly or through its parents |
interface.inheritance-resource:<I>:<parent> | a resource interface extending a plain one, or a plain one a resource one |
interface.member-conflict:<I>.<m>:<parent> | an interface declaring a parent's member again with another signature |
interface.default-ambiguous:<m>:<C> | two interfaces the class conforms to, neither extending the other, give m a default, and the class has no method of its own |
interface.plain-into-resource:<I>:<C> | a class that isn't a resource conforming to a resource interface |
interface.sealed-foreign:<I>:<name> | a class (or extend, or interface) in another module than the sealed interface I joining it |
when.is-type:<subject>:<type> | a when arm is T where T isn't a class conforming to the subject's interface, or an interface extending it |
interface.drop-member:<I> | an interface declaring drop, which is each resource class's own |
interface.cast-resource:<I> | as? on a resource interface's value, which would leave two owners (not supported yet; a when arm is A sees it as its class without moving it) |
interface.no-witness:<I>:<class> | at run time: a call through an interface on an instance of a class with no witness for it (the dispatch fallback; no program reaches it today) |
E_COMPILER_TRANSFORM_INTERFACE | compiler.declareInterface or compiler.addConformance outside a transform, or without its handle and names (compiler API) |
E_PARSE_NOT_YET_SUPPORTED | reserved syntax: a where clause, const type parameters, a sealed class, internal |
generic.cannot-infer:<f>:<T> | nothing at a call binds type parameter T: write the type arguments out (f<int>(…)) or give the result an expected type (generics); a class's generic method is named by its class (Bag.remap) |
generic.arity:<f>:<expected>:<written> | the wrong number of type arguments written out, or a generic class's type with the wrong number; at a generic method's or extension's call, the type arguments written name only the parameters the receiver's type doesn't fix |
generic.instantiation-depth:<f> | f's instances make ever larger instances (f(Box(x)) in f) |
generic.overload:<f> | a generic function sharing its name (and receiver) with another function |
generic.bound:<f>:<T>:<type>:<interface> | a type argument that is not the bound interface and doesn't conform to it (bounds); a bound that is a generic interface's instance reads as one (Ordered<i64>) |
generic.bound-not-interface:<f>:<T>:<bound> | a type parameter's bound that names no interface |
generic.interface-method:<I>.<m> | an interface's method with type parameters of its own: a call through an interface value would need each class's instance for each type argument (generic methods) |
generic.method-shadows:<C>.<m>:<T> | a method's type parameter named like one of its class's |
generic.reference:<f> | a generic function used as a value rather than called |
E_COMPILER_GENERIC_INSTANTIATE | compiler.instantiate of something that is no generic class or function, or with the wrong number of type arguments (compiler API) |
context[generic-instance]: <instance> | a record after a diagnostic placed in a generic's body: the instance (twice<Ticket>) in which it is an error |
native.trust:<f> | calling a trusted function from untrusted code (trusted code) |
native.runtime-internal:<f> | calling one of the runtime's address intrinsics or field-slot accessors outside abla/runtime, trusted or not (trusted code) |
noinline.*, naked.*, section.*, wasmImport.*, inline-assembly.* | misused annotations |
E_EXPORT_ANNOTATION, E_EXPORT_SIGNATURE_UNSUPPORTED, E_EXPORT_TARGET_CAPABILITY | an export with a bad name or a signature the foreign ABI can't express |
fun add(a: int, b: int): int = a + b
fun main: int = add(1, "two")
// error: function.argument:add
An explicit return also has to match the declared type.
fun main: int {
return "42"
}
// error: return.type@
// error: help: return a value of type
Ownership and borrowing
ownership.*, E_BORROW_CONFLICT, resource.*, move.*, shared.*, weak.*, mutex.* and cell.* codes are explained, with their usual fixes, in ownership.md. E_DELEGATE_* and E_NOT_DELEGATED are in language.md.
| Code | Meaning |
|---|---|
E_BORROW_CONFLICT | a change to an owner would invalidate a borrower that's still used later. Finish using the borrower first. |
E_OWNERSHIP | a move leaves the value or a part of it unavailable, or a closure that can run only once is called again. The dotted reason identifies which. |
E_DEFINITE_ASSIGNMENT | a variable may be read along a path that didn't assign it. Initialize it or assign it in every branch. |
class Counter(var value: int)
fun main: int {
val counter = Counter(0)
val view = counter
counter.value = 1
view.value
}
// error: E_BORROW_CONFLICT
// error: help: finish using the borrower
resource class Ticket(val seat: int)
fun consume(own ticket: Ticket): int = ticket.seat
fun main: int {
val ticket = Ticket(1)
consume(move(ticket))
ticket.seat
}
// error: E_OWNERSHIP
// error: ownership.use-after-move
fun main: int {
var answer: int
answer
}
// error: E_DEFINITE_ASSIGNMENT
// error: assignment.unassigned
Transactions
stm.outside-atomic, stm.effect:<effect>, stm.resource, stm.outside-mutation, stm.control:return and stm.orElse-type are explained in language.md. A misused TVar is reported as any generic class's is (TVar<T> of abla/stm, with a constructor of one argument, getValue() and setValue(value)), naming its instance as TVar<i64>: generic.cannot-infer:TVar:T, method.unknown, method.arity, method.argument. annotation.reserved:<name> is an annotation only the standard library may use (__abla_runtime_value).
Regions
| Code | Meaning |
|---|---|
region.result:<type> | a region produces something other than a scalar |
region.escape:<how> | a region-owned value is assigned, appended or stored outside the region |
region.control:<return/break/continue> | a jump out of a region body |
region.call-retention:<f>, region.indirect-call-retention, region.parameter-retention, region.receiver-retention | a call that may keep a region-owned value |
region.noescape-effect:<f> | a function declared noescape that does keep an argument |
See regions.md.
Generators, tasks and threads
defer.*, generator.*, yield.*, await.*, task.* and thread.* are listed in concurrency.md.
Compile time
| Code | Meaning |
|---|---|
E_EVAL_EXPRESSION | a compile-time evaluation failed; the message names the expression, and a source[eval] record with its --> line gives its file, line and column |
E_EVAL_STEP_LIMIT | an evaluation ran past the step limit |
E_EVAL_DIVISION_BY_ZERO | an integer division or remainder by zero under # (integers) |
E_EVAL_OUT_OF_BOUNDS | an index or slice out of bounds, or a negative truncate or filledArray count, under #, with the run-time panic's message |
E_EVAL_STACK_DEPTH | compile-time recursion nested deeper than the compiler's stack allows (limits) |
compile.effect-denied, compile.capability-not-authorized, compile.capability-unknown | capabilities |
E_COMPILE_NATIVE_DENIED | compile-time code reached something its module was not granted (trusted code, or a transform changing the standard library without transform.library); the message names the capability (capabilities) |
compile.value-runtime:<name> | run-time code reads a compile val/compile var |
compile.result: ... | a # result that can't become a program value |
declaration.block.compile-only | a declaration block in run-time code |
subparser.unknown:<name> | $name is not registered by any imported module; the help names the usual import (abla/json for $json) |
E_EXT_SUBPARSER_REGISTRATION, E_EXT_SUBPARSER_COLLISION | a bad or duplicate $name registration (subparsers.md) |
E_SUBPARSER_INVOCATION, E_SUBPARSER_FAILURE | a subparser handler failed or reported an error |
E_EXT_GENERATED_MODULE_REQUEST, E_EXT_GENERATED_SEMANTIC, E_EXT_GENERATED_PROVENANCE, E_EXT_NAMESPACE_* | a generated module was rejected |
E_EXT_FINALIZER_RESULT, E_GENERATED_EXTENSION_FINALIZER | an extension finalizer failed or returned the wrong thing |
E_EXT_FUNCTION_HANDLE_*, E_EXT_EXPRESSION_HANDLE_INVALID | a reflection handle that is unknown, out of range or of the wrong kind (compiler-api.md) |
E_EXT_TYPED_QUERY_BEFORE_RESOLUTION, E_REACTIVE_* | typed reflection asked too early, or an invalid lifted function |
E_COMPILER_TRANSFORM_* | a compiler.transform handler or its body/annotation changes were rejected |
E_COMPILER_TRANSFORM_RUNTIME | a transform asked to change a runtime function (abla/runtime), which it never may (transforms) |
E_COMPILER_TRANSFORM_PROGRAM | a transform or # site of a dependency asked to change a function or class of another package without the transform.program grant, also through a generated module's extension of a type of another package (grants per package) |
E_COMPILER_TRANSFORM_GRANTS | a transform asked to install a body with compile-time code (#, $) into a function whose file has grants the transform does not (grants per package) |
E_COMPILER_EDIT_CONFLICT | two transforms gave one function different bodies; the message names both (transforms) |
E_COMPILER_EDIT_TARGET | a transform's change to another module names no declaration, or more than one |
E_COMPILE_EDIT_FIXPOINT (compile.edit-fixpoint) | compile-time code changed the program in each of 8 rounds of lowering; the message lists the last round's edits (committing changes) |
E_INDEPENDENT_MODULE_* | a misused independent module (programmable-builds.md) |
E_CONTRACT_CALL_NOT_CONSUMED | a contract call left in the program |
E_IMPORT_ALIAS_MEMBER_AMBIGUOUS | an import alias names a member two nested exports of a facade both provide: import it from the module that defines it |
Modules and packages
| Code | Meaning |
|---|---|
E_NO_MAIN | the entry module has no fun main |
E_IMPORT_NOT_FOUND | an imported file doesn't exist; the message names the path it looked for |
E_IMPORT_PATH_UNQUOTED | a file or standard module path needs double quotes; the help line shows the import to write |
E_IMPORT_UNQUALIFIED_AMBIGUOUS | two unaliased imports expose the same name (modules) |
E_NAME_NOT_IMPORTED | a strict module uses a name of a module it doesn't import; help: is the import to add (a warning under --strict-imports=warn) |
E_IMPORT_ALIAS_INVALID | the import has an empty source or a spelling that can't be used as an alias |
E_IMPORT_ALIAS_DUPLICATE | two imports in the same module use the same alias |
E_IMPORT_ALIAS_DECLARATION_COLLISION | the alias has the same name as a declaration in the importing module |
E_IMPORT_ALIAS_TARGET_DUPLICATE | the same resolved module is imported more than once, even if one spelling uses an alias |
E_IMPORT_ALIAS_MEMBER_UNKNOWN | the module named by the alias exports no declaration of that name |
E_IMPORT_ALIAS_USED_AS_VALUE | an alias qualifies a declaration at compile time. It isn't a value that can be assigned, passed or returned. |
E_IMPORT_REMAP_MANIFEST | a line of the root abla.toml's [imports] isn't "<module>" = "<module>" (import remaps) |
E_IMPORT_REMAP_INVALID | a remapped module doesn't exist, maps to itself, is remapped twice, or its target is remapped too |
E_IMPORT_REMAP_MISMATCH | the target doesn't declare everything the source declares publicly with the same signatures; a note: per declaration missing or different |
E_IMPORT_REMAP_NOT_ROOT | a dependency's abla.toml (not the root's) has an [imports] table |
E_IMPORT_PROVIDER_* | a source provider expression or its result is invalid (packages.md) |
E_PACKAGE_* | lockfile, fetch, cache, digest, cycle and capability errors of dependencies (packages.md) |
E_NATIVE_LIBRARY_MANIFEST | invalid nativeLibraries in abla.toml |
For a local module path, check the path relative to the file that imports it.
import "missing/file.ab"
fun main {}
// error: E_IMPORT_NOT_FOUND
// error: help: check the path and spelling
Write import "abla/io" for the standard-library module.
import abla/io
fun main {}
// error: E_IMPORT_PATH_UNQUOTED
// error: help: write
Aliasing an import does not expose private declarations. If helpers.ab defines private fun answer(): int = 42, this call reports E_NAME_PRIVATE. Use a public declaration in that module, or remove private if you own that declaration and mean to expose it.
import "helpers.ab" as helpers
fun main: int = helpers.answer()
The following examples import these two modules:
fun value(): int = 42
fun value(): int = 0
An alias is an identifier. Use a name such as left that does not start with a digit and isn't a keyword.
import "diagnostics-left.ab" as 9left
fun main {}
// error: E_IMPORT_ALIAS_INVALID
Use different aliases for different modules.
import "diagnostics-left.ab" as dependency
import "diagnostics-right.ab" as dependency
fun main {}
// error: E_IMPORT_ALIAS_DUPLICATE
Choose an alias that isn't already declared locally.
import "diagnostics-left.ab" as dependency
fun dependency(): int = 0
fun main: int = dependency()
// error: E_IMPORT_ALIAS_DECLARATION_COLLISION
Import a module once and use that import's spelling everywhere in the file.
import "diagnostics-left.ab" as left
import "diagnostics-left.ab"
fun main: int = left.value()
// error: E_IMPORT_ALIAS_TARGET_DUPLICATE
Use a declaration the aliased module actually exposes, such as left.value() here.
import "diagnostics-left.ab" as left
fun main: int = left.missing()
// error: E_IMPORT_ALIAS_MEMBER_UNKNOWN
To store a value, call or reference a declaration on the module.
import "diagnostics-left.ab" as left
fun main: int {
val result = left
0
}
// error: E_IMPORT_ALIAS_USED_AS_VALUE
Unused declarations and imports
Warnings do not by themselves refuse a build. These categories are separate:
| Code | Control and scope |
|---|---|
W_UNUSED_IMPORT | On for batch builds by default; --no-warn-unused-imports or ABLA_WARN_UNUSED_IMPORTS=0 disables it, --warn-unused-imports enables it over the environment; cached builds replay their saved import warnings |
W_UNUSED_LOCAL | Opt in with --warn-unused-locals; an unused local binding in the project's own checked code |
W_UNUSED_PARAMETER | Opt in with --warn-unused-parameters; an unused parameter, with exported/native/protocol cases excluded |
W_UNUSED_DECLARATION | Opt in with --warn-unused-declarations; unused declarations/members/fields, subject to conservative references and exemptions |
The opt-in checks bypass the native build cache. Leading _ marks deliberately unused names. Editor graph clients request their own categories in initialize; see the toolchain warning controls. These are conservative source-use checks, not a proof that every unreachable declaration is reported. @exportLocal binding/signature failures remain errors, as described above; they are not unused-declaration warnings.
For example, the compiler reports W_UNUSED_IMPORT for a helper imported by main.ab when nothing in the program uses its declarations. Remove the import, or use export import when a package entry is meant to pass that module on.
Editor idiom hints
These hints appear in checked workspace files in graph analysis and carry a quick fix. They leave comments and code with uncertain types or effects alone.
| Code | Meaning |
|---|---|
W_NULLABLE_EARLY_EXIT | Combine an inferred nullable scalar binding and the immediately following null guard with ?? return or ?? continue. The null branch must only exit, with at most a literal return value. The initializer still runs once. |
W_ARRAY_MAPPED | Replace a fresh array and the immediately following single-append loop with array.mapped. The hint covers simple scalar transforms with no calls or captures when the standard extension is already imported and resolves unambiguously. |
W_LOGICAL_ASSIGNMENT | Replace x = x && expr or x = x || expr with the corresponding Boolean assignment for an ordinary mutable local. |
Builds
| Code | Meaning |
|---|---|
E_BUILD_TARGET_*, E_BUILD_ARTIFACT_UNSUPPORTED | an unknown target, artifact or target definition (programmable-builds.md) |
E_TARGET_HOST_LINK | a hosted Linux executable or shared library built on macOS, which has no Linux sysroot to link against |
E_BUILD_GRAPH_*, E_BUILD_PROGRAM_REQUEST, E_BUILD_OUTPUT, E_BUILD_IO | a programmable build graph that is invalid or couldn't be published |
E_SOURCE_NOT_FOUND (a build call's program) | a program a build file requests whose entry is not there (programmable-builds.md) |
E_BUILD_PATH_OUTSIDE | a path compile-time code names (a build call's entry or output, a file operation) outside its source file's project (the nearest abla.toml with a name, else the repository root, else the working directory) (programmable-builds.md, compile-time.md) |
E_ARTIFACT_* | artifact roots and slices (programmable-builds.md) |
E_NATIVE_TOOLCHAIN | the linker or another native tool failed |
Internal errors
E_IR_*, E_LLVM_*, E_COMPILER_UNCLASSIFIED and E_INTERNAL come from the later compiler stages. Every source mistake should be reported by an earlier check, with its own code. So if you see one of these, it is a compiler bug, whether or not another error came before it. Please report it with the smallest program that shows it.
Built from compiler source ba5d6b7d. Examples and generated signatures follow that source revision.