E1110: two modules declare one name

View source

A program is compiled as one unit.

A program is compiled as one unit. Inside it, a declaration name is unique, even when the two declarations sit in different modules and are used with different qualifiers (ADR-0110). Two modules that export a verb, struct, enum or constant with the same name but different content collide, and the compiler rejects the program before it generates code. The message names the symbol and both modules.

The rule also covers native declarations. Two extern "C" declarations of one symbol are one declaration only when their ownership roles, types and return types are identical. If they differ, the program would link one symbol with two incompatible contracts. Two identical declarations are accepted.

Example

actus
import circle;
import square;

verb main() {
}
actus
open area;
actus
open verb area() -> Int {
    return 1;
}
actus
open area;
actus
open verb area() -> Int {
    return 2;
}
actus
import left;
import right;

verb main() {
}
actus
open bridge;
actus
open unsafe extern "C" verb shared_bridge(abs buffer: Buffer) -> Int;
actus
open bridge;
actus
open unsafe extern "C" verb shared_bridge(ins buffer: Buffer) -> Int;

Fix

Rename one of the declarations, or make the two declarations identical. The native declarations below have the same contract, so they are one symbol.

actus
import left;
import right;

verb main() {
}
actus
open bridge;
actus
open unsafe extern "C" verb shared_bridge(abs buffer: Buffer) -> Int;
actus
open bridge;
actus
open unsafe extern "C" verb shared_bridge(abs buffer: Buffer) -> Int;

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