Skip to content

Commit

Permalink
fix literal cmp
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Nov 8, 2023
1 parent 2cc968e commit 014e989
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions vyper/semantics/types/bytestrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,21 @@ def compare_type(self, other):
if not super().compare_type(other):
return False

if self._length and other._length:
# when comparing two literals, invert the comparison so that the
# larger type is derived during annotation of the smaller type for widening
if self._is_literal and other._is_literal:
return self._length <= other._length
# when comparing two literals, invert the comparison so that the
# larger type is derived during annotation of the smaller type for widening
if self._is_literal and other._is_literal:
return self._length <= other._length

# otherwise, ensure the current length fits within the other
# if both are non-literals, ensure the current length fits within the other
if self._length and other._length:
return self._length >= other._length

# relax typechecking if length has not been set for other type
# (e.g. JSON ABI import) so that it can be updated in annotation phase
if self._length:
return True

return other.compare_type(self)
# return other.compare_type(self)

@classmethod
def from_annotation(cls, node: vy_ast.VyperNode) -> "_BytestringT":
Expand Down

0 comments on commit 014e989

Please sign in to comment.