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

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

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

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

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

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

    A comprehension body does not match the element type required by its expected context.

    Diagnostic and cause

    Ссылка

    Comprehension body type mismatch

    Семейство
    topaz
    Этап
    check
    Код
    TPZ5610

    Причина и условия

    A comprehension body must satisfy the element type required by its collection context. An Array<int> comprehension whose body produces string must be rejected with the registered TPZ5610 diagnostic.

    Действия

    Make the body produce the expected element type, or change the collection annotation to match the intended data.

    Compiler phase: check.

    Compiler explanation: A comprehension body does not match the element type required by its expected context.

    Message templates are Pending. The explanation above is not an observed CLI message.

    A comprehension body must satisfy the element type required by its collection context. An Array<int> comprehension whose body produces string must be rejected with the registered TPZ5610 diagnostic.

    Правилоdiagnostics.tpz5610.p5.rule

    Comprehension body and expected element type

    A comprehension body must satisfy the element type required by its collection context. An Array<int> comprehension whose body produces string must be rejected with the registered TPZ5610 diagnostic.

    Response

    Ссылка

    Make the body produce the expected element type, or change the collection annotation to match the intended data.

    Reproduction and verification

    Ссылка

    Rejected program

    Ссылка
    example.tpzRejected programОткрыть песочницу →
    1. let values: Array<int> = [for value in ([1]) => "text"]
    Ожидаемый выводНенулевой код завершения
    Нет стандартного вывода.
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

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

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

    Контракт обязательного основного местоположения не определён.

    The source establishes a TPZ5001 collection mismatch for this input. The product assertion retains the intended TPZ5610 identity. Its dedicated message and primary location remain undetermined; the cause matcher recognizes the actual source-backed mismatch text.

    Repaired program

    Ссылка
    example.tpzRepaired program
    1. let values: Array<int> = [for value in ([1]) => value]
    Ожидаемый выводКод завершения 0
    $ topaz check example.tpz · Целевой продукт 5.21.3
    Ожидаемый результат

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

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

    The source establishes a TPZ5001 collection mismatch for this input. The product assertion retains the intended TPZ5610 identity. Its dedicated message and primary location remain undetermined; the cause matcher recognizes the actual source-backed mismatch text.

    Меню

    Загрузка →