Перейти к содержимому
Топаз6.0 · До релиза
Загрузка →

Поиск в документации

Спецификация 6.0

Выберите результат стрелками и нажмите Enter, чтобы открыть его.

Введите имя API, номер диагностики, правило или тему проекта.

    Диагностика TPZ5510

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

    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.

    Действия

    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.

    Правилоdiagnostics.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.

    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

    Ссылка
    example.tpzRejected programОткрыть песочницу →
    1. function identity<T>(value: T) -> T { value }
    2. let result = identity<int, string>(1)
    Ожидаемый выводНенулевой код завершения
    Нет стандартного вывода.
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

    Ожидаемый результат

    Этап отклонения check. Ненулевой код завершения.

    Repaired program

    Ссылка
    example.tpzRepaired program
    1. function identity<T>(value: T) -> T { value }
    2. let result = identity<int>(1)
    Ожидаемый выводКод завершения 0
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

    Ожидаемый результат

    Проверка принимает программу. Код завершения 0.

    Меню

    Загрузка →