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

    TPZ5610: Comprehension body type mismatch

    A comprehension body does not match the element type required by its expected context.

    Diagnostic and cause

    Link

    Comprehension body type mismatch

    Family
    topaz
    Phase
    check
    Code
    TPZ5610

    Cause and conditions

    A comprehension body must satisfy the element type required by its collection context. An Array<int> comprehension whose body produces string must be rejected with the registered TPZ5610 diagnostic.

    Response

    Make the body produce the expected element type, or change the collection annotation to match the intended data.

    Source evidence

    Compiler phase: check.

    Compiler explanation: A comprehension body does not match the element type required by its expected context.

    Message templates are Pending. The explanation above is not an observed CLI message.

    A comprehension body must satisfy the element type required by its collection context. An Array<int> comprehension whose body produces string must be rejected with the registered TPZ5610 diagnostic.

    Rulediagnostics.tpz5610.p5.rule

    Comprehension body and expected element type

    A comprehension body must satisfy the element type required by its collection context. An Array<int> comprehension whose body produces string must be rejected with the registered TPZ5610 diagnostic.

    Source evidence

    Response

    Link

    Make the body produce the expected element type, or change the collection annotation to match the intended data.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. let values: Array<int> = [for value in ([1]) => "text"]
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Rejection during check. Nonzero exit.

    • TPZ5610 comprehension-body-type-mismatch

    The required primary-location contract is Pending.

    The source establishes a TPZ5001 collection mismatch for this input. The product assertion retains the intended TPZ5610 identity. Its dedicated message and primary location remain undetermined; the cause matcher recognizes the actual source-backed mismatch text.

    Source evidence

    Repaired program

    Link
    example.tpzRepaired program
    1. let values: Array<int> = [for value in ([1]) => value]
    Expected outputexit 0
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Checking accepts the program. Exit code 0.

    The source establishes a TPZ5001 collection mismatch for this input. The product assertion retains the intended TPZ5610 identity. Its dedicated message and primary location remain undetermined; the cause matcher recognizes the actual source-backed mismatch text.

    Source evidence

    Menu

    Download