Skip to content

Commit

Permalink
remove type validation in subscript
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Jul 19, 2023
1 parent 4e7b958 commit 8c0cf51
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions vyper/semantics/types/subscriptable.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ def getter_signature(self) -> Tuple[Tuple, Optional[VyperType]]:

def validate_index_type(self, node):
# TODO: break this cycle
from vyper.semantics.analysis.utils import validate_expected_type
#from vyper.semantics.analysis.utils import validate_expected_type

validate_expected_type(node, self.key_type)
#validate_expected_type(node, self.key_type)
pass


class HashMapT(_SubscriptableT):
Expand Down Expand Up @@ -126,15 +127,16 @@ def count(self):

def validate_index_type(self, node):
# TODO break this cycle
from vyper.semantics.analysis.utils import validate_expected_type
#from vyper.semantics.analysis.utils import validate_expected_type

if isinstance(node, vy_ast.Int):
if node.value < 0:
raise ArrayIndexException("Vyper does not support negative indexing", node)
if node.value >= self.length:
raise ArrayIndexException("Index out of range", node)

validate_expected_type(node, IntegerT.any())
#validate_expected_type(node, IntegerT.any())
pass

def get_subscripted_type(self, node):
return self.value_type
Expand Down

0 comments on commit 8c0cf51

Please sign in to comment.