Skip to content

Commit

Permalink
Adding check to prevent incorrectly treating non-final variables as f…
Browse files Browse the repository at this point in the history
…inal
  • Loading branch information
marcoeilers committed Jan 20, 2024
1 parent e085059 commit b5126ed
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/nagini_translation/translators/statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,8 @@ def _assign_single_value(self, lhs: ast.AST, rhs: Expr, rhs_type: PythonType,
after_assign = []
if isinstance(target, PythonGlobalVar):
if target.is_final:
if lhs not in target.writes:
raise UnsupportedException(lhs, "Internal error: Variable may have been incorrectly tagged as final.")
# For final variables, we assume that the function representing the
# variable is equal to the RHS of the assignment. For pure values,
# this will do nothing, since the postcondition will already say the same;
Expand Down

0 comments on commit b5126ed

Please sign in to comment.