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

    TPZ3010: Imported module exports nothing

    A module import targets a module with no exported surface.

    Diagnostic and cause

    Link

    Imported module exports nothing

    Family
    topaz
    Phase
    resolve
    Code
    TPZ3010

    Cause and conditions

    Historical SELF behavior: importing a module with no exported declarations produces TPZ3010. The recommended Modules contract permits an empty-export namespace import and uses TPZ3009 when an absent member is selected. The namespace acceptance and current-product limitation on the Modules page are the normative /v6.0/en/docs expectations for that decision; the reproduction below preserves the historical diagnostic identity.

    Response

    For the current SELF product, put initialization in the entry or expose a real public operation that the application needs. The recommended contract requires no dummy export: an ordinary namespace import can initialize a module with no public members. TPZ3010 remains reserved for the historical restriction and is not reassigned.

    Source evidence

    Compiler phase: resolve.

    Compiler explanation: A module import targets a module with no exported surface.

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

    • ⟨value⟩ exports nothing; v5.2 has no side-effect-only imports Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ3010]: lib exports nothing; v5.2 has no side-effect-only imports

    Historical SELF restriction: the imported module has an empty export table. The recommended uniform module contract permits that namespace import and initializes the module normally.

    Rulediagnostics.tpz3010.rule

    Trigger and repair

    Historical SELF behavior: importing a module with no exported declarations produces TPZ3010. The recommended Modules contract permits an empty-export namespace import and uses TPZ3009 when an absent member is selected. The namespace acceptance and current-product limitation on the Modules page are the normative /v6.0/en/docs expectations for that decision; the reproduction below preserves the historical diagnostic identity.

    Source evidence

    Response

    Link

    For the current SELF product, put initialization in the entry or expose a real public operation that the application needs. The recommended contract requires no dummy export: an ordinary namespace import can initialize a module with no public members. TPZ3010 remains reserved for the historical restriction and is not reassigned.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. import lib
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    lib.tpzRejected programOpen in Playground
    1. let privateValue = 1
    Expected result

    Expected result

    Rejection during resolve. Nonzero exit.

    • TPZ3010 diagnostic-tpz3010 at example.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 lib
    Expected outputexit 0
    $ topaz check example.tpz · target product 5.21.3
    lib.tpzCorrected programOpen in Playground
    1. export let privateValue = 1
    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