---
title: "U2001: Type mismatch"
url: https://una-lang.org/en/docs/errors/U2001/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U2001.md
---

# U2001: Type mismatch

An expression does not have the type expected where it appears. The message names the type expected and the type found.

## Why Una rejects it

Every expression has a type, and where a type is expected, by a declaration, a parameter, an operator or the other branches of an `if` or `when`, the expression must have that type (`spec/10`).

Types are compared by their base: a refined kind such as `Seats` is its base `Int`, so its refinement becomes a proof obligation rather than a mismatch (`spec/03 §6`).

U2001 also reports:

- values that `==` cannot compare because they hold functions,
- `<` on a type without an order,
- interpolation, in edition `0.1`, of a type other than `Int`, `Bool` and `Text`, and from edition `0.2`, of a value whose type holds a function or a `Hashed`,
- a call with the wrong number of arguments,
- `attempt` on something other than one call,
- a type that inference cannot determine, such as the element type of an unused empty list.

## The repair at a glance

```diff
  module demo

- pub label(count: Int) -> Text = count
+ pub label(count: Int) -> Text = "{count}"
```

## Failing example

```una
module demo

pub label(count: Int) -> Text = count
```

## Fixed example

```una
module demo

pub label(count: Int) -> Text = "{count}"
```
