Diagnostic and cause
LinkReserved operator
- Family
- topaz
- Phase
- parse
- Code
TPZ2013
Cause and conditions
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.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 328-340 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 1464-1464 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 1442-1472 - TPZ2013 at
151141d7bb44
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.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 1442-1472 - TPZ2013 at
151141d7bb44
Response
LinkChoose the operation required by the program. Use - for arithmetic negation or ! for Boolean negation. Neither is an integer bitwise-negation replacement.
Reproduction and verification
LinkRejected program
Linklet flags = 1let result = ~flags
No stdout.
Expected result
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 328-340 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 1464-1464 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 1442-1472 - TPZ2013 at
151141d7bb44
Corrected program
Linklet flags = 1let result = -flags
Expected result
Expected result
Checking accepts the program. Exit code 0.
This program applies the repair described above. The verification status records whether it has been run.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 1442-1472 - TPZ2013 at
151141d7bb44