Diagnostic and cause
СсылкаReserved operator
- Семейство
- topaz
- Этап
- parse
- Код
TPZ2013
Причина и условия
The unary operator ~ is reserved and rejected during parsing.
Действия
Choose the operation required by the program. Use - for arithmetic negation or ! for Boolean negation. Neither is an integer bitwise-negation replacement.
Compiler phase: parse.
Compiler explanation: The source used an operator spelling reserved away from the current language.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
- reserved operator
~: Topaz has no bitwise operations Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ2013]: reserved operator
~: Topaz has no bitwise operations
The expression uses ~, which is reserved. Topaz does not provide an integer bitwise-negation operation through this spelling.
Trigger and repair
The unary operator ~ is reserved and rejected during parsing.
Response
СсылкаChoose the operation required by the program. Use - for arithmetic negation or ! for Boolean negation. Neither is an integer bitwise-negation replacement.
Reproduction and verification
СсылкаRejected program
Ссылкаlet flags = 1let result = ~flags
Нет стандартного вывода.Ожидаемый результат
Ожидаемый результат
Этап отклонения parse. Ненулевой код завершения.
diagnostic-tpz2013 at
example.tpz:2:14
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Corrected program
Ссылкаlet flags = 1let result = -flags
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This program applies the repair described above. The verification status records whether it has been run.