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

    TPZ5522: Missing protocol conformance

    A protocol call or generic protocol bound requires a conformance the receiver type does not have.

    Diagnostic and cause

    Link

    Missing protocol conformance

    Family
    topaz
    Phase
    check
    Code
    TPZ5522

    Cause and conditions

    A concrete type argument must satisfy every declared protocol bound. Calling a Show-bounded function with a record lacking Show conformance is rejected with TPZ5522.

    Response

    Derive or implement the required protocol when supported. For a generic function, add the bound that its body or callers require.

    Source evidence

    Compiler phase: check.

    Compiler explanation: A protocol call or generic protocol bound requires a conformance the receiver type does not have.

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

    • protocol ⟨value⟩ has no method ⟨value⟩ Source
    • ⟨value⟩ does not satisfy protocol bound ⟨value⟩ Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ5522]: User does not satisfy protocol bound Show

    A concrete type argument must satisfy every declared protocol bound. Calling a Show-bounded function with a record lacking Show conformance is rejected with TPZ5522.

    Rulediagnostics.tpz5522.p5.rule

    Missing protocol conformance

    A concrete type argument must satisfy every declared protocol bound. Calling a Show-bounded function with a record lacking Show conformance is rejected with TPZ5522.

    Source evidence

    Response

    Link

    Derive or implement the required protocol when supported. For a generic function, add the bound that its body or callers require.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. record User { name: string }
    2. function render<T: Show>(value: T) -> string { Show.show(value) }
    3. let result = render(User { name: "Ada" })
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Rejection during check. Nonzero exit.

    • TPZ5522 diagnostic-tpz5522 at example.tpz:3:14
    Source evidence

    Repaired program

    Link
    example.tpzRepaired program
    1. record User derives Show { name: string }
    2. function render<T: Show>(value: T) -> string { Show.show(value) }
    3. let result = render(User { name: "Ada" })
    Expected outputexit 0
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Checking accepts the program. Exit code 0.

    Source evidence

    Menu

    Download