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

    TPZ3015: Assignment to imported binding

    The program attempts to assign to a binding imported from another module.

    Diagnostic and cause

    Link

    Assignment to imported binding

    Family
    topaz
    Phase
    resolve
    Code
    TPZ3015

    Cause and conditions

    Assigning to a selected import binding produces TPZ3015.

    Response

    Copy the value into your own let mut binding, or call an operation exported by the producing module.

    Source evidence

    Compiler phase: resolve.

    Compiler explanation: The program attempts to assign to a binding imported from another module.

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

    • ⟨value⟩ is an imported binding and cannot be assigned Source
    • ⟨value⟩.⟨value⟩ is an exported binding viewed through a namespace and cannot be assigned Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ3015]: value is an imported binding and cannot be assigned

    The assignment targets a name introduced by a selected import. Importing a binding does not make it mutable in the importing module.

    Rulediagnostics.tpz3015.rule

    Trigger and repair

    Assigning to a selected import binding produces TPZ3015.

    Source evidence

    Response

    Link

    Copy the value into your own let mut binding, or call an operation exported by the producing module.

    Reproduction and verification

    Link

    Rejected program

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

    Expected result

    Rejection during resolve. Nonzero exit.

    • TPZ3015 diagnostic-tpz3015 at example.tpz:2:1

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