Skip to content

Commit

Permalink
Fix tests and review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Dec 21, 2023
1 parent b028b0c commit 0920eb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion vyper/semantics/types/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
13 changes: 7 additions & 6 deletions vyper/semantics/types/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down

0 comments on commit 0920eb6

Please sign in to comment.