E1119: name is outside the scope of its module

View source

Inside one unit, a directory module sees its own declarations, those of its ancestors, and the exports of the children that its facade opens (ADR-0110).

Inside one unit, a directory module sees its own declarations, those of its ancestors, and the exports of the children that its facade opens (ADR-0110). Anything else needs an explicit import. A sibling or cousin directory is not in scope, a child's private declaration is not in scope, and an import written in a parent file is not inherited by its children, whether it names a module of the unit or another unit such as std (REQ-MOD-0005): a child that calls buffer_size unqualified is rejected when only its parent writes import std::io;, and the message names the parent and the fix, import { std::io } in the child with io::buffer_size, or import { open std::io }. The message names the name, the module that declares it, and the module that uses it. For a directory that is out of scope, it shows the import that brings it in.

The error is also reported when a name is reached through an import of another unit's child module and that child does not export it.

A plain import { a }; binds the namespace a and brings no unqualified name into any module (ADR-0087, ADR-0110). In a module of a unit, an unqualified spelling that only a plain import could supply is reported at the spelling; the root module reports the same spelling with the code of an unknown name, such as E1069 for a verb. The message names the referencing module, the spelling and the module that exports it, and gives the two fixes: qualify the spelling (a::seven, preferred) or write import { open a };. A call that passes self to a role method is dispatched by the role of the receiver and is not affected by how the role's module is imported.

With src/a/a.act opening f and src/a/f.act declaring open verb seven() -> Int, a file of module b that writes

text
import { a };
open verb via_b() -> Int { return seven(); }

reports E1119 at seven: the module b imports a without open. Write a::seven(), or import { open a }; to bring every export of a into the unqualified scope. A selecting import such as import { a { seven } }; brings only the selected names.

Example

actus
open verb width() -> u8 {
    return WIDTH;
}
actus
import pkg;

verb main() {
    erg width = pkg::width();
}
actus
open layout;
open runtime;
actus
open size;
actus
open const WIDTH: u8 = 4u8;
actus
open count;

Fix

Import the module that declares the name in a file of the module that uses it.

actus
import { open pkg::layout };

open verb width() -> u8 {
    return WIDTH;
}
actus
import pkg;

verb main() {
    erg width = pkg::width();
}
actus
open layout;
open runtime;
actus
open size;
actus
open const WIDTH: u8 = 4u8;
actus
open count;

Run actus explain E1119 in your terminal to read this entry offline. Browse Modules & rules or all error codes.