Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Jul 25, 2023
1 parent 7ae5564 commit dbd85e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
10 changes: 5 additions & 5 deletions vyper/semantics/analysis/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,6 @@ def visit_Return(self, node):
f"expected {self.func.return_type.length}, got {len(values)}",
node,
)
for given, expected in zip(values, self.func.return_type.member_types):
validate_expected_type(given, expected)
else:
validate_expected_type(values, self.func.return_type)
self.expr_visitor.visit(node.value, self.func.return_type)


Expand Down Expand Up @@ -715,6 +711,7 @@ def visit_Call(self, node: vy_ast.Call, typ: Optional[VyperType] = None) -> None
#self.visit(node.func, call_type)

if isinstance(call_type, ContractFunctionT):
node._metadata["type"] = call_type.fetch_call_return(node)
# function calls
if call_type.is_internal:
self.func.called_functions.add(call_type)
Expand Down Expand Up @@ -748,7 +745,6 @@ def visit_Call(self, node: vy_ast.Call, typ: Optional[VyperType] = None) -> None
for arg, arg_type in zip(node.args, call_type.arg_types):
self.visit(arg, arg_type)
else:
node._metadata["type"] = call_type.fetch_call_return(node)
# builtin functions
arg_types = call_type.infer_arg_types(node)
# `infer_arg_types` already calls `validate_expected_type`
Expand All @@ -758,6 +754,8 @@ def visit_Call(self, node: vy_ast.Call, typ: Optional[VyperType] = None) -> None
for kwarg in node.keywords:
self.visit(kwarg.value, kwarg_types[kwarg.arg])

node._metadata["type"] = call_type.fetch_call_return(node)

def visit_Compare(self, node: vy_ast.Compare, typ: Optional[VyperType] = None) -> None:
if isinstance(node.op, (vy_ast.In, vy_ast.NotIn)):
# membership in list literal - `x in [a, b, c]`
Expand Down Expand Up @@ -892,6 +890,8 @@ def visit_List(self, node: vy_ast.List, typ: Optional[VyperType] = None) -> None
derived_typ = sarray_t
elif typ and typ.compare_type(darray_t):
derived_typ = darray_t
else:
derived_typ = darray_t

node._metadata["type"] = derived_typ

Expand Down
2 changes: 1 addition & 1 deletion vyper/semantics/analysis/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def _validate_self_namespace():
if not check_constant(node.value):
raise StateAccessViolation("Value must be a literal", node.value)

validate_expected_type(node.value, type_)
#validate_expected_type(node.value, type_)
_validate_self_namespace()

return _finalize()
Expand Down
4 changes: 0 additions & 4 deletions vyper/semantics/types/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,6 @@ def fetch_call_return(self, node: vy_ast.Call) -> Optional[VyperType]:
if kwarg_node is not None:
raise CallViolation("Cannot send ether to nonpayable function", kwarg_node)

for arg, expected in zip(node.args, self.argument_types):
validate_expected_type(arg, expected)

# TODO this should be moved to validate_call_args
for kwarg in node.keywords:
if kwarg.arg in self.call_site_kwargs:
Expand All @@ -511,7 +508,6 @@ def fetch_call_return(self, node: vy_ast.Call) -> Optional[VyperType]:
f"`{kwarg.arg}=` specified but {self.name}() does not return anything",
kwarg.value,
)
validate_expected_type(kwarg.value, kwarg_settings.typ)
if kwarg_settings.require_literal:
if not isinstance(kwarg.value, vy_ast.Constant):
raise InvalidType(
Expand Down

0 comments on commit dbd85e2

Please sign in to comment.