docs← Back to article

Markdown for LLMs

LDC-E2106 — A match that misses an enum case

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

Download this articlePlain text ↗
# LDC-E2106 — A match that misses an enum case

## What it means

A match over an enum must account for every case: each variant needs
its own branch, or a wildcard branch that catches the rest. Leaving a
variant uncovered is a static error — the expression would have no
value for that input, and the compiler refuses to leave the gap.

Adding a branch for the missing variant, or a wildcard branch at the
end, makes the match exhaustive and clears the diagnostic.

## Example

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

enum Status { Active; Suspended; Revoked; }
relation s(x: Status) kind institutional;
relation f(a: Decimal) kind institutional;
relation done(x: Status) kind institutional;
rule R strict { for x: Status; when s(x) and f(match x { Active => 1; Suspended => 2; }); then done(x); }
```

## Fix

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

enum Status { Active; Suspended; Revoked; }
relation s(x: Status) kind institutional;
relation f(a: Decimal) kind institutional;
relation done(x: Status) kind institutional;
rule R strict { for x: Status; when s(x) and f(match x { Active => 1; Suspended => 2; Revoked => 3; }); then done(x); }
```

## Engine message

The engine reports this in its own wording:

```text
example.law:9:48: error LDC-E2106: non-exhaustive match on Status: ["Revoked"] are not covered — static error in core-executable (§39/§55.1)
```

## Related

- [Expressions and quantities](/constructs/expressions-quantities/) — how match expressions are written.