Error codes

E0116: a local named like a module or dependency is used as a path

In a terminal: auk explain E0116 prints this page.

On this page

m. is always a path when m names a module of this package, the package itself, a dependency or core. A local (parameter, let, var, for or pattern binding, closure parameter) with the same name makes m.f(...) ambiguous: it could be a call on the value or a call of the module's function. Auk rejects it instead of picking one silently. Rename the local.

Locals do shadow the core modules fs net time rand env proc str int float: with a parameter env, env.get(k) is a method call on it, and core.env.get(k) still reaches the module.

Wrong#

The project has a module src/geo.auk:

toml
[package]
name = "app"
version = "0.1.0"
auk
pub fn area(w: int, h: int): int = w * h
auk
fn first(geo: [int]): int? = geo.first()
fn main() { print(first([1, 2])) }

Fixed#

auk
fn first(sizes: [int]): int? = sizes.first()
fn main() { print(first([1, 2])) }

Common causes#

  • A parameter named after a helper module of the project (geo, parse, util).
  • A parameter named after a dependency (json, http, csv).

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page