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

    TPZ0005: Stray brace in string

    A template/text string contains a brace that is not a valid interpolation boundary.

    Diagnostic and cause

    Link

    Stray brace in string

    Family
    topaz
    Phase
    lex
    Code
    TPZ0005

    Cause and conditions

    A literal closing brace in single-line string text must be escaped as \}. An unescaped brace produces TPZ0005.

    Response

    Escape a literal closing brace. When interpolation was intended, supply the opening brace and expression.

    Source evidence

    Compiler phase: lex.

    Compiler explanation: A template/text string contains a brace that is not a valid interpolation boundary.

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

    • unescaped } in a string literal; write \} Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ0005]: unescaped } in a string literal; write \}

    A closing brace appears unescaped in single-line string text. It is not closing a currently parsed interpolation.

    Rulediagnostics.tpz0005.rule

    Trigger and repair

    A literal closing brace in single-line string text must be escaped as \}. An unescaped brace produces TPZ0005.

    Source evidence

    Response

    Link

    Escape a literal closing brace. When interpolation was intended, supply the opening brace and expression.

    Reproduction and verification

    Link

    Rejected program

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

    Expected result

    Rejection during lex. Nonzero exit.

    • TPZ0005 diagnostic-tpz0005 at example.tpz:1: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 program
    1. let message = "\}"
    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