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

    TPZ3013: Namespace member has wrong kind

    A namespace member is used in a position that requires a different export kind.

    Diagnostic and cause

    Link

    Namespace member has wrong kind

    Family
    topaz
    Phase
    resolve
    Code
    TPZ3013

    Cause and conditions

    Using a namespace member that exports a type alias as a value produces TPZ3013. Use that alias in a type annotation.

    Response

    Use ns.Count in a type annotation or select a value export for the expression.

    Source evidence

    Compiler phase: resolve.

    Compiler explanation: A namespace member is used in a position that requires a different export kind.

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

    • namespace members are exported declarations and cannot be keyword-named (⟨value⟩.⟨value⟩) Source
    • ⟨value⟩ is an exported type alias of ⟨value⟩, not a value; use it in type position Source
    • ⟨value⟩ is exported by ⟨value⟩ but is not a type alias Source
    • the head of a qualified type must be a namespace binding; ⟨value⟩ is not one here Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ3013]: Count is an exported type alias of lib, not a value; use it in type position

    The selected member exports a type alias, but the expression requires a value. Nominal constructor names have a separate admitted path.

    Rulediagnostics.tpz3013.rule

    Trigger and repair

    Using a namespace member that exports a type alias as a value produces TPZ3013. Use that alias in a type annotation.

    Source evidence

    Response

    Link

    Use ns.Count in a type annotation or select a value export for the expression.

    Reproduction and verification

    Link

    Rejected program

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

    Expected result

    Rejection during resolve. Nonzero exit.

    • TPZ3013 diagnostic-tpz3013 at example.tpz:2:16

    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.Count = 1
    Expected outputexit 0
    $ topaz check example.tpz · target product 5.21.3
    lib.tpzCorrected programOpen in Playground
    1. export type Count = int
    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