---
title: "U2014: Expression outside the refinement language"
url: https://una-lang.org/en/docs/errors/U2014/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U2014.md
---

# U2014: Expression outside the refinement language

A clause or a predicate of `checked` holds an expression outside the refinement language. The diagnostic points at the outermost sub-expression outside the language.

## Why Una rejects it

`where`, `requires` and `ensures` clauses, and the predicate of `checked`, are written in the refinement language, which the verifier decides (`spec/03 §3`). The language has:

- integer, boolean and text literals;
- parameters, `it`, `result`, field access, `.len`;
- `+`, `-`, `*` with a literal operand, `/` and `mod` by a nonzero literal;
- comparisons, `in`, `is` with a variant;
- `and`, `or`, `not`, `implies`;
- calls of predicates.

## How to fix it

- When the fix is mechanical, such as `x is V` for `x == V` or `x == 1` for `x is 1`, the diagnostic carries an edit.
- To use a function in a contract, state what it computes in the contract, or as a predicate.

## The repair at a glance

```diff
  module demo

  pub shift(x: Int) -> Int
-   requires abs(x) < 100
+   requires x > -100 and x < 100
  =
    x
```

## Failing example

```una
module demo

pub shift(x: Int) -> Int
  requires abs(x) < 100
=
  x
```

## Fixed example

```una
module demo

pub shift(x: Int) -> Int
  requires x > -100 and x < 100
=
  x
```
