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

    TPZ2013: Reserved operator

    The source used an operator spelling reserved away from the current language.

    Diagnostic and cause

    Link

    Reserved operator

    Family
    topaz
    Phase
    parse
    Code
    TPZ2013

    Cause and conditions

    The unary operator ~ is reserved and rejected during parsing.

    Response

    Choose the operation required by the program. Use - for arithmetic negation or ! for Boolean negation. Neither is an integer bitwise-negation replacement.

    Source evidence

    Compiler phase: parse.

    Compiler explanation: The source used an operator spelling reserved away from the current language.

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

    • reserved operator ~: Topaz has no bitwise operations Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ2013]: reserved operator ~: Topaz has no bitwise operations

    The expression uses ~, which is reserved. Topaz does not provide an integer bitwise-negation operation through this spelling.

    Rulediagnostics.tpz2013.rule

    Trigger and repair

    The unary operator ~ is reserved and rejected during parsing.

    Source evidence

    Response

    Link

    Choose the operation required by the program. Use - for arithmetic negation or ! for Boolean negation. Neither is an integer bitwise-negation replacement.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. let flags = 1
    2. let result = ~flags
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Rejection during parse. Nonzero exit.

    • TPZ2013 diagnostic-tpz2013 at example.tpz:2:14

    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 flags = 1
    2. let result = -flags
    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