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 repair at a glance

src/a.unadiff
  module a

- helper() -> Int = 1
+ pub helper() -> Int = 1

Failing example

src/a.unauna
module a

helper() -> Int = 1
src/main.unauna
module main

import a (helper)

pub two() -> Int = helper() + 1

Fixed example

src/a.unauna
module a

pub helper() -> Int = 1
src/main.unauna
module main

import a (helper)

pub two() -> Int = helper() + 1