Home / Docs / Diagnostics
U1001: Unresolved name
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):
- a local binding (a parameter, a
let, a pattern binding or a lambda parameter), - a declaration of the module,
- a name the module imports,
- the prelude.
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:
std.host, with the host capabilities and their failure kinds, in every edition,std.testing, with the helpers for examples, in every edition,std.time,std.driveandstd.limit, from edition0.4,std.collections, from edition0.5.
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
module demo
+ double(x: Int) -> Int = x * 2
+
pub total(x: Int) -> Int = double(x)Failing example
module demo
pub total(x: Int) -> Int = double(x)Fixed example
module demo
double(x: Int) -> Int = x * 2
pub total(x: Int) -> Int = double(x)