LYR-RES0012
a name that is also a submodule
A module declares or imports a name that is also the last segment of one of its submodules: http in app.net beside the file src/net/http.lyr. Reported whether or not the submodule is imported.
Explanation
A module has one namespace: app.net.http would mean both the member http of app.net and the module app.net.http, and which one depended on the route. The root module is no exception — its names stand beside every module of its package.
Rename the member or the submodule. A pub import that binds a submodule under its own name is that module and is allowed.
Wrong
//- src/main.lyr
import app.net;
import app.net.http;
fn main(): void {
assert(net.http() + http.get() == 3);
}
//- src/net.lyr
pub fn http(): int {
return 1;
}
//- src/net/http.lyr
pub fn get(): int {
return 2;
}
Right
//- src/main.lyr
import app.net;
import app.net.http;
fn main(): void {
assert(net.status() + http.get() == 3);
}
//- src/net.lyr
pub fn status(): int {
return 1;
}
//- src/net/http.lyr
pub fn get(): int {
return 2;
}