Reference

Diagnostics

A rejected source gets exactly one diagnostic: the first problem in a fixed order of checks, with a stable kind[code]. Every page below shows a source that triggers the code and a fix, both run through ulang-lite when this site was built.

KindMeans
syntaxthe text is not v1 contract syntax
limita resource bound was exceeded: size, nesting, tokens, literal range, condition depth
unsupportedthe construct parses, but is outside the executable subset
semanticthe contract is well formed but inconsistent: types, names, clause ids, actions, mode

syntax

CodeMeaning
syntax[syntax]The text is not µLang v1 contract syntax.

limit

CodeMeaning
limit[source-size]The source is empty, or larger than maxSourceBytes (65,536 UTF-8 bytes by default).
limit[nesting-or-tokens]{ ( [ nest deeper than maxNesting (20), or the source has more than maxTokens (6,000) words.
limit[boolean-tokens]The text AND or OR occurs more than maxBooleanOperators (256) times.
limit[integer-range]An integer literal outside ±(2^53−1).
limit[float-range]A float literal that is not finite, or whose magnitude exceeds 2^53−1.
limit[condition-depth]A condition tree deeper than maxConditionDepth (16).

unsupported

CodeMeaning
unsupported[not-operator]The text NOT appears outside a string, comment or source tag.
unsupported[arithmetic]+ * / ^, or a - that is not directly followed by a digit.
unsupported[type-unsupported]A field or constant type other than int, float, bool or string.
unsupported[constants-named]A named CONSTANTS block.
unsupported[constant-form]A constant without a [SOURCE:id] tag.
unsupported[constant-type]A constant whose type is not primitive, found by checkConstants.
unsupported[constant-invalid]A soft (=), duplicate or badly named constant, or a value of the wrong kind or range.
unsupported[trigger-form]A trigger without parentheses, or with a WHEN guard.
unsupported[trigger-params]A trigger with parameters.
unsupported[ensure-form]An ENSURE that is not exactly ENSURE action() WHEN condition [SOURCE:id].
unsupported[forbid-form]A FORBID with arguments, or without a condition or source tag.
unsupported[call-or-arithmetic]A function call, or a subtraction such as cap -1, in a condition.
unsupported[condition-form]A condition that is a bare operand or an assignment.
unsupported[literal-comparison]A name compared with a literal, such as cap == 25.
unsupported[unknown-field]Entity.field where the entity declares no such field.
unsupported[unknown-name]A name that is not a declared constant.
unsupported[foreign-reference]A path on another entity, or a parenthesised value.
unsupported[kind-mismatch]Comparing values of different kinds, or ordering strings or booleans.
unsupported[nonnumeric-comparison]A string or boolean comparison not written as Entity.field op literal.

semantic

CodeMeaning
semantic[empty-guarantee]A GUARANTEE block with no ENSURE clauses.
semantic[enforcement-mode]The contract is not ENFORCEMENT_MODE: enforced.
semantic[context-required]The contract has no CONTEXT.
semantic[entity]Not exactly one named ENTITIES block, or not the entity the caller expects.
semantic[fields]Duplicate fields, or fields that differ from the schema the caller pinned.
semantic[constant-collides]A constant has the same name as a field.
semantic[trigger-required]The contract has no TRIGGER block.
semantic[trigger-entry]A duplicate trigger action, or one the caller did not expect.
semantic[trigger-incomplete]TRIGGER does not list exactly the actions the caller pinned.
semantic[clause-source]An executable clause without a source tag, found by validateContract.
semantic[clause-id]An invalid or duplicate clause id, [ SOURCE: with a space, or an action not in TRIGGER.
semantic[clause-predicate]A clause without WHEN, found by validateContract.
semantic[ungoverned-action]An action in TRIGGER has no clause.
semantic[duplicate-contract]Two contracts with the same name in one source.