LDC-W2151 — Literal amounts with different currencies or units in one operation
What it means
Section titled “What it means”Two literals written directly as operands of one operation carry different
tags: two money amounts in different currencies, or two quantities with
different unit tags. The operation is one that needs matching tags —
addition, subtraction, division, a comparison, or the standard min,
max and div_round.
The engine never converts between currencies or units implicitly, so such
an operation cannot produce the value the text suggests. The warning names
both literals. It looks only at literals written in place: the currency or
unit of a variable, a constant or a computed value is not inferred, and a
user function that happens to be called min keeps its own contract. A
percentage is a plain decimal and has no unit tag. The warning never fails
the check.
Example
Section titled “Example”language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
relation owes(m: Money) kind institutional;
rule R strict { then owes(100 KZT + 5 USD);}language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
relation owes(m: Money) kind institutional;
rule R strict { then owes(100 KZT + 5 KZT);}Documentation for Arxo. Writings — blog.arxo.io.
Anonymous visit counts on stats.arxo.io, no cookies.