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

    TPZ5510: Wrong number of explicit type arguments

    A call supplied a different number of type arguments than the generic declaration has parameters.

    Diagnostic and cause

    Link

    Wrong number of explicit type arguments

    Family
    topaz
    Phase
    check
    Code
    TPZ5510

    Cause and conditions

    When explicit type arguments are supplied to a generic call, their number must equal the callee's declared type-parameter count. A different nonzero count is rejected with TPZ5510.

    Response

    Supply one type argument for every type parameter, or remove the explicit list when inference can determine all of them.

    Source evidence

    Compiler phase: check.

    Compiler explanation: A call supplied a different number of type arguments than the generic declaration has parameters.

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

    • this call expects ⟨value⟩ type argument⟨value⟩, but ⟨value⟩ ⟨value⟩ supplied Source

    Observed for the candidate in Topaz 5.21.3. Execution

    • error[TPZ5510]: this call expects 1 type argument, but 2 were supplied

    When explicit type arguments are supplied to a generic call, their number must equal the callee's declared type-parameter count. A different nonzero count is rejected with TPZ5510.

    Rulediagnostics.tpz5510.p5.rule

    Wrong number of explicit type arguments

    When explicit type arguments are supplied to a generic call, their number must equal the callee's declared type-parameter count. A different nonzero count is rejected with TPZ5510.

    Source evidence

    Response

    Link

    Supply one type argument for every type parameter, or remove the explicit list when inference can determine all of them.

    Reproduction and verification

    Link

    Rejected program

    Link
    example.tpzRejected programOpen in Playground
    1. function identity<T>(value: T) -> T { value }
    2. let result = identity<int, string>(1)
    Expected outputNonzero exit
    No stdout.
    $ topaz check example.tpz · target product 5.21.3
    Expected result

    Expected result

    Rejection during check. Nonzero exit.

    • TPZ5510 diagnostic-tpz5510 at example.tpz:2:14
    Source evidence

    Repaired program

    Link
    example.tpzRepaired program
    1. function identity<T>(value: T) -> T { value }
    2. let result = identity<int>(1)
    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