Home / Docs / Diagnostics
U1004: Use of a private declaration from another module
Release v0.4.0
An import names a declaration that is not public. The diagnostic points at the imported name and shows the declaration.
Why Una rejects it
Declarations are private to their module unless they are marked pub (spec/04 §5), and an import can name only public declarations.
How to fix it
- The diagnostic carries an edit that adds
pubto the declaration. The edit is marked as a widening of visibility, since every module may then use the declaration (ADR 0097). - The other fix, which keeps the module's interface, is to import a public declaration instead.
The repair at a glance
src/a.una
module a
- helper() -> Int = 1
+ pub helper() -> Int = 1Failing example
src/a.una
module a
helper() -> Int = 1src/main.una
module main
import a (helper)
pub two() -> Int = helper() + 1Fixed example
src/a.una
module a
pub helper() -> Int = 1src/main.una
module main
import a (helper)
pub two() -> Int = helper() + 1