Markdown for LLMs
LDC-W2151 — Literal amounts with different currencies or units in one operation
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# LDC-W2151 — Literal amounts with different currencies or units in one operation
## 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
```law
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);
}
```
## Fix
```law
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);
}
```
## Engine message
The engine reports this in its own wording:
```text
example.law:8:15: warning LDC-W2151: «+»: literal operands have different currencies (KZT and USD); this operation requires matching tags and performs no implicit conversion (§48, §50, §58)
```
## Related
- [Expressions and quantities](/constructs/expressions-quantities/) — money, quantities and their tags.
- [LDC-E2108](/diagnostics/LDC-E2108/) — operands of different kinds.