docs← Back to article

Markdown for LLMs

LDC-E2107 — An unreachable branch after a wildcard

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

Download this articlePlain text ↗
# LDC-E2107 — An unreachable branch after a wildcard

## What it means

A wildcard branch matches everything, so any branch written after it
can never run. The compiler keeps the package working and warns at the
dead branch instead of refusing it — the match still evaluates, but
the shadowed branch is decoration.

This is a warning, not a refusal: the package still checks. Moving the
wildcard to the end, or dropping the shadowed branch, clears it.

## 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 { _ => 0; Active => 1; }); 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; _ => 0; }); then done(x); }
```

## Engine message

The engine reports this in its own wording:

```text
example.law:9:66: warning LDC-E2107: unreachable branch "Active" after wildcard (§55.1)
```

## Related

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