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

    TPZ2007: Invalid exported let pattern

    An exported let pattern must bind at least one name.

    Diagnostic and cause

    Link

    Invalid exported let pattern

    Family
    topaz
    Phase
    parse
    Code
    TPZ2007

    Cause and conditions

    An exported let uses the ordinary immutable let pattern rules and publishes every bound name. A pattern with no bound name is rejected with TPZ2007 during parsing.

    Response

    Remove export when no name is published, or bind the names that callers need with an ordinary immutable let pattern.

    Source evidence

    The 6.0 contract rejects exported patterns without a bound name. The following message and observation describe the historical 5.21.3 single-identifier restriction. They do not prohibit destructuring in Topaz 6.0.

    Compiler phase: parse.

    Compiler explanation: An exported let declaration uses a pattern other than one identifier.

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

    • an exported let binds exactly one identifier; destructure privately, then export the identifier Source

    An exported let pattern binds no name. Use export for one or more ordinary immutable pattern bindings.

    Rulediagnostics.tpz2007.rule

    Trigger and repair

    An exported let uses the ordinary immutable let pattern rules and publishes every bound name. A pattern with no bound name is rejected with TPZ2007 during parsing.

    Source evidence

    Response

    Link

    Remove export when no name is published, or bind the names that callers need with an ordinary immutable let pattern.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. export let _ = 1
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz --format json · target product 5.21.3
    Expected result

    Expected result

    Rejection during parse. Nonzero exit.

    • TPZ2007 export-let-no-binding at example.tpz:1:12

    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. let _ = 1
    Expected outputexit 0
    $ topaz check example.tpz --format json · target product 5.21.3
    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