diff --git a/tests/parser/syntax/test_enum.py b/tests/parser/syntax/test_enum.py index 267de2180f..fe7b9fc83d 100644 --- a/tests/parser/syntax/test_enum.py +++ b/tests/parser/syntax/test_enum.py @@ -137,6 +137,12 @@ def run() -> Order: }) """, "enum Foo:\n" + "\n".join([f" member{i}" for i in range(256)]), + """ +a: constant(uint256) = 1 + +enum A: + a + """, ] diff --git a/vyper/ast/folding.py b/vyper/ast/folding.py index baf3f48336..8d89d85b41 100644 --- a/vyper/ast/folding.py +++ b/vyper/ast/folding.py @@ -284,6 +284,10 @@ def replace_constant( if assign and node in assign.target.get_descendants(include_self=True): continue + # do not replace enum members + if node.get_ancestor(vy_ast.EnumDef): + continue + try: # note: _replace creates a copy of the replacement_node new_node = _replace(node, replacement_node, type_=type_)