---
title: "U2007: Non-exhaustive `when` over variants"
url: https://una-lang.org/en/docs/errors/U2007/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U2007.md
---

# U2007: Non-exhaustive `when` over variants

A `when` whose arms test variants matches every variant of the sum kind, or ends with an `else` arm, so that every value takes an arm (`spec/10 §4`). The message lists the variants that no arm matches. For range and literal arms, exhaustiveness is a proof obligation instead (`spec/12 §3`).

## The repair at a glance

```diff
  module demo

  pub kind Level = Low | Mid | High

  pub rank(level: Level) -> Int
  =
    when level
      is Low -> 0
+     is Mid -> 1
      is High -> 2
```

## Failing example

```una
module demo

pub kind Level = Low | Mid | High

pub rank(level: Level) -> Int
=
  when level
    is Low -> 0
    is High -> 2
```

## Fixed example

```una
module demo

pub kind Level = Low | Mid | High

pub rank(level: Level) -> Int
=
  when level
    is Low -> 0
    is Mid -> 1
    is High -> 2
```
