Home / Docs / Diagnostics

U1003: Import cycle

Release v0.4.0

Modules form a graph through their imports, and that graph has no cycle: a module cannot import, directly or through other modules, a module that imports it. U1003 is reported once per cycle, at the first import of the cycle's first module in path order, and names every module of the cycle. Move the declarations that both sides need into a module that both import.

Failing example

src/a.unauna
module a

import b (two)

pub one() -> Int = 1

pub three() -> Int = two() + 1
src/b.unauna
module b

import a (one)

pub two() -> Int = one() + 1

Fixed example

src/a.unauna
module a

import b (two)

pub three() -> Int = two() + 1
src/b.unauna
module b

import c (one)

pub two() -> Int = one() + 1
src/c.unauna
module c

pub one() -> Int = 1