Diagnostic and cause
СсылкаInvalid assignment target
- Семейство
- topaz
- Этап
- parse
- Код
TPZ2003
Причина и условия
An assignment target must be an identifier, member access, or index access.
Связанное правило · Trigger and repair →Действия
Assign to a mutable binding or to a supported member or index rooted in one. Mutability and type compatibility are checked after this syntax requirement.
Compiler phase: parse.
Compiler explanation: The left side of an assignment is not an assignable place.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
- assignment target must be an identifier, member access, or index access Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ2003]: assignment target must be an identifier, member access, or index access
The left side of an assignment is a computed expression. The parser accepts an identifier, member access, or index access in that position.
Trigger and repair
An assignment target must be an identifier, member access, or index access.
Response
СсылкаAssign to a mutable binding or to a supported member or index rooted in one. Mutability and type compatibility are checked after this syntax requirement.
Reproduction and verification
СсылкаRejected program
Ссылка(1 + 2) = 3
Нет стандартного вывода.Ожидаемый результат
Ожидаемый результат
Этап отклонения parse. Ненулевой код завершения.
diagnostic-tpz2003 at
example.tpz:1:1
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 mut value = 1value = 3
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This program applies the repair described above. The verification status records whether it has been run.