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

    TPZ3012: Namespace used as value

    A module namespace binding appears where a runtime value is required.

    Diagnostic and cause

    Link

    Namespace used as value

    Family
    topaz
    Phase
    resolve
    Code
    TPZ3012

    Cause and conditions

    Reading an imported namespace as a standalone value produces TPZ3012. Select an exported member instead.

    Response

    Select an exported member, such as ns.member, before storing or passing the value.

    Source evidence

    Compiler phase: resolve.

    Compiler explanation: A module namespace binding appears where a runtime value is required.

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

    • ⟨value⟩ is a namespace, not a value; it may appear only as ⟨value⟩.member Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ3012]: ns is a namespace, not a value; it may appear only as ns.member

    The expression names the module namespace itself. A namespace provides member access and is not a runtime value.

    Rulediagnostics.tpz3012.rule

    Trigger and repair

    Reading an imported namespace as a standalone value produces TPZ3012. Select an exported member instead.

    Source evidence

    Response

    Link

    Select an exported member, such as ns.member, before storing or passing the value.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. import lib as ns
    2. let value = ns
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    lib.tpzRejected programOpen in Playground
    1. export let member = 1
    Expected result

    Expected result

    Rejection during resolve. Nonzero exit.

    • TPZ3012 diagnostic-tpz3012 at example.tpz:2:13

    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 as ns
    2. let value = ns.member
    Expected outputexit 0
    $ topaz check example.tpz · target product 5.21.3
    lib.tpzCorrected programOpen in Playground
    1. export let member = 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