Diagnostic and cause
СсылкаInvalid defer body
- Семейство
- topaz
- Этап
- parse
- Код
TPZ2004
Причина и условия
The body of a defer statement must be a block (topaz.decision.defer-block-only.1).
Связанное правило · Trigger and repair →Действия
Place the deferred work in a block.
Compiler phase: parse.
Compiler explanation: A defer statement body is neither a block nor a call expression.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
defertakes a block or a call Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ2004]:
defertakes a block or a call
A defer statement has a body that is not a block.
Trigger and repair
The body of a defer statement must be a block (topaz.decision.defer-block-only.1).
Response
СсылкаPlace the deferred work in a block.
Reproduction and verification
СсылкаRejected program
Ссылкаdefer 1
Нет стандартного вывода.Ожидаемый результат
Ожидаемый результат
Этап отклонения parse. Ненулевой код завершения.
diagnostic-tpz2004 at
example.tpz:1:7
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Corrected program
Ссылкаdefer {}
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This program applies the repair described above. The verification status records whether it has been run.