Skip to content
Topaz6.0 · Before release
Download

Search documentation

Specification 6.0 · Not released · Tested product 5.21.3

Use arrow keys to choose a result. Press Enter to open.

Type an API name, diagnostic number, rule, or project topic.

    Diagnostics

    TPZ3006: Import cycle

    The module graph contains a cyclic import dependency.

    Diagnostic and cause

    Link

    Import cycle

    Family
    topaz
    Phase
    resolve
    Code
    TPZ3006

    Cause and conditions

    A directed cycle in the module import graph produces TPZ3006.

    Response

    Remove a dependency from the cycle or put shared declarations in a third module that both modules can import.

    Source evidence

    Compiler phase: resolve.

    Compiler explanation: The module graph contains a cyclic import dependency.

    Message templates. The marker ⟨value⟩ stands for text computed for the reported program.

    • import cycle: ⟨value⟩ Source
    • module imports itself: ⟨value⟩ Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ3006]: import cycle: first -> second -> first

    The import graph leads back to a module already on the dependency path. The example forms first -> second -> first.

    Rulediagnostics.tpz3006.rule

    Trigger and repair

    A directed cycle in the module import graph produces TPZ3006.

    Source evidence

    Response

    Link

    Remove a dependency from the cycle or put shared declarations in a third module that both modules can import.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. import first
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    first.tpzRejected programOpen in Playground
    1. import second
    2. export let one = 1
    second.tpzRejected programOpen in Playground
    1. import first
    2. export let two = 2
    Expected result

    Expected result

    Rejection during resolve. Nonzero exit.

    • TPZ3006 diagnostic-tpz3006 at first.tpz:1:8

    The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.

    Source evidence

    Corrected program

    Link
    example.tpzCorrected programOpen in Playground
    1. import first
    Expected outputexit 0
    $ topaz check example.tpz · target product 5.21.3
    first.tpzCorrected programOpen in Playground
    1. import second
    2. export let one = 1
    second.tpzCorrected programOpen in Playground
    1. export let two = 2
    Expected result

    Expected result

    Checking accepts the program. Exit code 0.

    This program applies the repair described above. The verification status records whether it has been run.

    Source evidence

    Menu

    Download