import-cycle

Packages import each other in a circle.

compile error, shown by synod check.

Imports must form a graph without cycles, because a node that runs a package also runs everything it uses, in dependency order. The error shows the cycle, for example a → b → a. Move what both need into a third package.

Example

Check this program to see the diagnostic.

# package a
use example.com/explain/b

define One
  result b.Two
# package b
use example.com/explain/a

define Two
  result a.One

Diagnostic

a/a.synod:2:5: error[import-cycle]: import cycle: a → b → a

Fix

Break the cycle so that only one package imports the other.

# package a
use example.com/explain/b

define One
  result b.Two
# package b
define Two
  result 2