Skip to content

Commit e60b021

Browse files
fix: disable uadd operator (#3174)
it should have been disabled, but there was some code which was never removed which bypassed the check.
1 parent 1a568bf commit e60b021

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/parser/exceptions/test_syntax_exception.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def foo():
7474
"""
7575
a: internal(uint256)
7676
""",
77+
"""
78+
@external
79+
def foo():
80+
x: uint256 = +1 # test UAdd ast blocked
81+
""",
7782
]
7883

7984

vyper/ast/annotation.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,6 @@ def visit_UnaryOp(self, node):
230230
"""
231231
self.generic_visit(node)
232232

233-
# TODO once grammar is updated, remove this
234-
# UAdd has no effect on the value of it's operand, so it is discarded
235-
if isinstance(node.op, python_ast.UAdd):
236-
return node.operand
237-
238233
is_sub = isinstance(node.op, python_ast.USub)
239234
is_num = (
240235
hasattr(node.operand, "n")

0 commit comments

Comments
 (0)