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

    TPZ2003: Invalid assignment target

    The left side of an assignment is not an assignable place.

    Diagnostic and cause

    Link

    Invalid assignment target

    Family
    topaz
    Phase
    parse
    Code
    TPZ2003

    Cause and conditions

    An assignment target must be an identifier, member access, or index access.

    Response

    Assign to a mutable binding or to a supported member or index rooted in one. Mutability and type compatibility are checked after this syntax requirement.

    Source evidence

    Compiler phase: parse.

    Compiler explanation: The left side of an assignment is not an assignable place.

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

    • assignment target must be an identifier, member access, or index access Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ2003]: assignment target must be an identifier, member access, or index access

    The left side of an assignment is a computed expression. The parser accepts an identifier, member access, or index access in that position.

    Rulediagnostics.tpz2003.rule

    Trigger and repair

    An assignment target must be an identifier, member access, or index access.

    Source evidence

    Response

    Link

    Assign to a mutable binding or to a supported member or index rooted in one. Mutability and type compatibility are checked after this syntax requirement.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. (1 + 2) = 3
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Rejection during parse. Nonzero exit.

    • TPZ2003 diagnostic-tpz2003 at example.tpz:1: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 program
    1. let mut value = 1
    2. value = 3
    Expected outputexit 0
    $ topaz check example.tpz · 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