Skip to content

Commit

Permalink
fix order of literal hex validation rules (#2791)
Browse files Browse the repository at this point in the history
It's more user friendly to complain about the underscores first
  • Loading branch information
charles-cooper authored Apr 14, 2022
1 parent c4c6afd commit 539764c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vyper/ast/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,10 @@ class Hex(Constant):
_translated_fields = {"n": "value"}

def validate(self):
if len(self.value) % 2:
raise InvalidLiteral("Hex notation requires an even number of digits", self)
if "_" in self.value:
raise InvalidLiteral("Underscores not allowed in hex literals", self)
if len(self.value) % 2:
raise InvalidLiteral("Hex notation requires an even number of digits", self)


class Str(Constant):
Expand Down

0 comments on commit 539764c

Please sign in to comment.