From 0920eb611eae9537acf19c298f4b87188c9b7d08 Mon Sep 17 00:00:00 2001 From: Daniel Schiavini Date: Thu, 21 Dec 2023 10:29:34 +0100 Subject: [PATCH] Fix tests and review comment --- vyper/semantics/types/base.py | 4 +++- vyper/semantics/types/module.py | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/vyper/semantics/types/base.py b/vyper/semantics/types/base.py index 2feb5ff14c..6ecfe78be3 100644 --- a/vyper/semantics/types/base.py +++ b/vyper/semantics/types/base.py @@ -91,7 +91,9 @@ def __hash__(self): return hash(self._get_equality_attrs()) def __eq__(self, other): - return self is type(other) and self._get_equality_attrs() == other._get_equality_attrs() + return ( + type(self) is type(other) and self._get_equality_attrs() == other._get_equality_attrs() + ) def __lt__(self, other): return self.abi_type.selector_name() < other.abi_type.selector_name() diff --git a/vyper/semantics/types/module.py b/vyper/semantics/types/module.py index a3087b0972..b0d7800011 100644 --- a/vyper/semantics/types/module.py +++ b/vyper/semantics/types/module.py @@ -232,16 +232,17 @@ def from_ModuleT(cls, module_t: "ModuleT") -> "InterfaceT": @classmethod def from_InterfaceDef(cls, node: vy_ast.InterfaceDef) -> "InterfaceT": functions = [] - for sub_node in node.body: - if not isinstance(node, vy_ast.FunctionDef): + for func_ast in node.body: + if not isinstance(func_ast, vy_ast.FunctionDef): raise StructureException( - "Interfaces can only contain function definitions", sub_node + "Interfaces can only contain function definitions", func_ast ) - if len(sub_node.decorator_list) > 0: + if len(func_ast.decorator_list) > 0: raise StructureException( - "Function definition in interface cannot be decorated", node.decorator_list[0] + "Function definition in interface cannot be decorated", + func_ast.decorator_list[0], ) - functions.append((sub_node.name, ContractFunctionT.from_InterfaceDef(sub_node))) + functions.append((func_ast.name, ContractFunctionT.from_InterfaceDef(func_ast))) # no structs or events in InterfaceDefs events: list = []