Diagnostic and cause
СсылкаWrong number of explicit type arguments
- Семейство
- topaz
- Этап
- check
- Код
TPZ5510
Причина и условия
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 →Действия
Supply one type argument for every type parameter, or remove the explicit list when inference can determine all of them.
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.
Response
СсылкаSupply one type argument for every type parameter, or remove the explicit list when inference can determine all of them.
Reproduction and verification
СсылкаRejected program
Ссылкаfunction identity<T>(value: T) -> T { value }let result = identity<int, string>(1)
Нет стандартного вывода.Ожидаемый результат
Ожидаемый результат
Этап отклонения check. Ненулевой код завершения.
diagnostic-tpz5510 at
example.tpz:2:14
Repaired program
Ссылкаfunction identity<T>(value: T) -> T { value }let result = identity<int>(1)
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.