Skip to content
ZOLO / TE160 Type · error

invalid immutable record update

Compiler diagnostic TE160: invalid immutable record update.

An immutable update requires a known record type:

let next = user with { name: "Ana", address.city: "Recife" }

TE160 reports a non-record or insufficiently known target, a non-record path prefix, duplicate/overlapping paths, or a record containing linear resources. Annotate an unknown value with its record type, unwrap an optional, or match a union before updating it. Each path must name stored fields of that record. Missing/private fields use TE102; incompatible new values use the normal type mismatch diagnostic.

address and address.city cannot occur in the same update: the whole address would conflict with a nested replacement. Two distinct sibling paths such as address.city and address.postal_code are valid.

Updates copy the original record and the changed record prefixes. A linear resource cannot be implicitly duplicated, even when its field is replaced. Build a new value with explicit ownership transfer instead.

See Data structures.

During compile-time evaluation, the base also needs proven record type and defining-module information. Add an explicit record annotation when that information is unavailable; a map value is not inferred to be a record by its keys alone. Context-free constant folding leaves updates intact.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

en