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
표준 출력 없음.기대 결과
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.