---
title: "U4008: A text literal with interpolation in a pattern"
url: https://una-lang.org/en/docs/errors/U4008/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U4008.md
---

# U4008: A text literal with interpolation in a pattern

A pattern holds a text literal with interpolation. U4008 reports it in every edition.

## Why Una rejects it

A pattern's literal is a constant: a `when` arm `is "…"` and the expression `x is "…"` compare a value with it (`spec/10 §4`).

A text literal with interpolation, such as `"{s}"`, is not a constant: its text is computed from the values it interpolates, and those can be labeled. Testing a value against it would decide a branch, or a `Bool`, by those values without their labels (`spec/07 §7` rule 3), so U4008 reports it, in every edition.

## How to fix it

- Compare with `==` instead, whose result carries the labels of both sides.
- Or match a constant.

## The repair at a glance

`src/demo.una`

```diff
  module demo

- pub matches(name: Text, other: secret Text) -> Bool = name is "{other}"
+ pub matches(name: Text, other: secret Text) -> secret Bool = name == other
```

## Failing example

`src/demo.una`

```una
module demo

pub matches(name: Text, other: secret Text) -> Bool = name is "{other}"
```

## Fixed example

`src/demo.una`

```una
module demo

pub matches(name: Text, other: secret Text) -> secret Bool = name == other
```
