LDC-E2119 — An empty-collection fallback of the wrong kind
For LLMs5 sections
What it means
Section titled “What it means”An aggregate over a collection declares its element kind, and the empty-collection fallback must be of that same kind: the fallback becomes the aggregate value when the collection is empty, so a money collection needs a money fallback, not an integer. The usual scalar-widening rule does not apply here — the fallback is the aggregate’s own value, not an arithmetic operand.
Rewriting the fallback in the element kind clears it. The message names both kinds found, which shows which side to adjust.
Example
Section titled “Example”language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
entity Order;relation amount(x: Order, a: Money) kind empirical;relation total(x: Order, a: Money) kind institutional;rule R strict { for o: Order; for t: Money; when amount(o, t); then total(o, sum(collect all a: Money, x: Order where amount(x, a), empty: 0));}language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
entity Order;relation amount(x: Order, a: Money) kind empirical;relation total(x: Order, a: Money) kind institutional;rule R strict { for o: Order; for t: Money; when amount(o, t); then total(o, sum(collect all a: Money, x: Order where amount(x, a), empty: 0 KZT));}Documentation for Arxo. Writings — blog.arxo.io.
Anonymous visit counts on stats.arxo.io, no cookies.