Skip to content

Commit

Permalink
fix constant var decl expr visit
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Nov 17, 2023
1 parent c77244c commit f39effa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vyper/semantics/analysis/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,11 @@ def _validate_self_namespace():
raise exc.with_annotation(node) from None

if node.is_constant:
ExprVisitor().visit(node.value, type_)
if not node.value:
raise VariableDeclarationException("Constant must be declared with a value", node)

ExprVisitor().visit(node.value, type_)

if not check_variable_constancy(node.value, VariableConstancy.COMPILE_TIME_CONSTANT):
raise StateAccessViolation("Value must be a literal", node.value)

Expand Down

0 comments on commit f39effa

Please sign in to comment.