docs← Back to article

Markdown for LLMs

LDC-E2141 — A variants cell of the wrong type

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# LDC-E2141 — A variants cell of the wrong type

## What it means

A row of variants declares the type of each cell up front, and every cell
must hold a value of that type: money in the stated currency for a money
cell, a non-negative value for a natural cell, and so on. A cell that
breaks the declared type would feed the scenario a value the norm never
quantifies over. The compiler checks each cell against its declared type
and refuses the row at the offending value.

The fix is inside the cell: write the value in the declared type and
currency. Scenario rows always carry a separate notice that they are not
part of the program itself; the type refusal clears as soon as the value
matches, and the corrected value below is shown as a plain assertion.

## Example

```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";

entity KZT;
test "row" variants (m: Money<KZT>) {
"r" (100);
} {
given {}
}
```

## Fix

```law
language "law.core" version "0.2";
package demo.diagnostics version "0.1.0";
namespace "urn:law:demo:diagnostics";

entity KZT;
relation due(m: Money<KZT>) kind empirical;
assert due(100 KZT);
```

## Engine message

The engine reports this in its own wording:

```text
example.law:7:6: error LDC-E2141: variants: cell m does not match type Money
```

## Related

- [Facts and evidence](/constructs/facts-and-evidence/) — what an assertion carries.
- [Expressions and quantities](/constructs/expressions-quantities/) — how money values are written.