Home / Docs / Diagnostics

U1001: Unresolved name

Release v0.4.0

U1001 reports a name that refers to nothing visible where it is used, whether it names a value, a type, a capability, a handler, a module or an imported declaration.

Why Una rejects it

Every name must refer to something visible where it is used (ADR 0023):

U1001 reports a name that none of these holds.

An import names a module of the package or one of the standard modules that its edition can import:

The prelude is always in scope and is not imported.

A variant in a when pattern, an is test or after fail takes its kind from the context, and is checked against that kind instead.

An operation that a capability does not declare is unresolved too, after @x. in a call and after expect performed or expect not performed in an example.

How to fix it

For an operation that a capability does not declare, the diagnostic offers the closest operation as an edit (ADR 0082).

The repair at a glance

diff
  module demo

+ double(x: Int) -> Int = x * 2
+
  pub total(x: Int) -> Int = double(x)

Failing example

una
module demo

pub total(x: Int) -> Int = double(x)

Fixed example

una
module demo

double(x: Int) -> Int = x * 2

pub total(x: Int) -> Int = double(x)