Diagnostic and cause
LinkWrong 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.
Related rule: Wrong number of explicit type argumentsResponse
Supply one type argument for every type parameter, or remove the explicit list when inference can determine all of them.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 788-797 - compiler/crates/topaz_self_frontend/topaz/checker/call_plan.tpz at
151141d7bb44· 1193-1193 - compiler/crates/topaz_self_frontend/topaz/checker/call_plan.tpz at
151141d7bb44· 1170-1197
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.
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
- compiler/crates/topaz_self_frontend/topaz/checker/call_plan.tpz at
151141d7bb44· 1170-1197
Response
LinkSupply one type argument for every type parameter, or remove the explicit list when inference can determine all of them.
Reproduction and verification
LinkRejected program
Linkfunction identity<T>(value: T) -> T { value }let result = identity<int, string>(1)
No stdout.
Expected result
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/call_plan.tpz at
151141d7bb44· 1170-1197
Repaired program
Linkfunction identity<T>(value: T) -> T { value }let result = identity<int>(1)
Expected result
Expected result
Checking accepts the program. Exit code 0.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/call_plan.tpz at
151141d7bb44· 1170-1197