Lyricdev
GitHub

LYR-RES0009

a name the place may not see

error ยท spec 04-modules

A use or an import reaches a declaration its visibility hides from this place: a private name from another module, an internal name from another package, a hidden field, or another module's import.

Explanation

A declaration without a word is visible in its package, pub everywhere, private in its own module only; a field follows the same rule, and a type with a field this module may not name is not built here. An import is its own module's and is never reached through it.

Mark the declaration pub (or remove private) where it is declared, call a function of its module that does the work, or import the name from the module that declares it.

Wrong

//- src/main.lyr
import app.util { helper };

fn main(): void {
    assert(helper() == 1);
}
//- src/util.lyr
private fn helper(): int {
    return 1;
}
//- src/main.lyr
import app.util { helper };

fn main(): void {
    assert(helper() == 1);
}
//- src/util.lyr
pub fn helper(): int {
    return 1;
}