Skip to content

Commit

Permalink
add another note
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Dec 31, 2023
1 parent c93ece1 commit 2f00b29
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vyper/semantics/analysis/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ def validate_modification(self, node: vy_ast.VyperNode, mutability: StateMutabil
if self.location == DataLocation.CODE:
if node.get_ancestor(vy_ast.FunctionDef).get("name") != "__init__":
raise ImmutableViolation("Immutable value cannot be written to", node)

# special handling for immutable variables in the ctor
# TODO: we probably want to remove this restriction.
if self.var_info._modification_count: # type: ignore
raise ImmutableViolation(
Expand Down

0 comments on commit 2f00b29

Please sign in to comment.