Lyricdev
GitHub

LYR-RES0010

a pub import of a name that is not pub

error ยท spec 04-modules

A pub import passes on a name that is not pub where it is declared.

Explanation

pub import passes a name on to every module and package that imports this one; it passes on what is pub and nothing narrower. A name visible in its package only would otherwise leave it through a facade.

Mark the name pub where it is declared, or import it without pub.

Wrong

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

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

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