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

    TPZ3017: Duplicate import

    The same logical module is imported more than once in one module.

    Diagnostic and cause

    Link

    Duplicate import

    Family
    topaz
    Phase
    resolve
    Code
    TPZ3017

    Cause and conditions

    Importing the same logical module twice from one module produces TPZ3017, including imports that select different names.

    Response

    Combine the selected names into one import declaration or use one namespace import.

    Source evidence

    Compiler phase: resolve.

    Compiler explanation: The same logical module is imported more than once in one module.

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

    • ⟨value⟩ is already imported by this module; a logical module may appear in at most one import item Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ3017]: lib is already imported by this module; a logical module may appear in at most one import item

    The module already has an import for the same logical dependency. Different selection lists do not create distinct dependencies.

    Rulediagnostics.tpz3017.rule

    Trigger and repair

    Importing the same logical module twice from one module produces TPZ3017, including imports that select different names.

    Source evidence

    Response

    Link

    Combine the selected names into one import declaration or use one namespace import.

    Reproduction and verification

    Link

    Rejected program

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

    Expected result

    Rejection during resolve. Nonzero exit.

    • TPZ3017 diagnostic-tpz3017 at example.tpz:2: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 lib { first, second }
    Expected outputexit 0
    $ topaz check example.tpz · target product 5.21.3
    lib.tpzCorrected programOpen in Playground
    1. export let first = 1
    2. export let second = 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