---
title: "U1004: Use of a private declaration from another module"
url: https://una-lang.org/en/docs/errors/U1004/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U1004.md
---

# U1004: Use of a private declaration from another module

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 `pub` to 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`

```diff
  module a

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

## Failing example

`src/a.una`

```una
module a

helper() -> Int = 1
```

`src/main.una`

```una
module main

import a (helper)

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

## Fixed example

`src/a.una`

```una
module a

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

`src/main.una`

```una
module main

import a (helper)

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