Skip to content
Snippets Groups Projects
Commit 23e7a9bb authored by Daniel Bauer's avatar Daniel Bauer :speech_balloon:
Browse files

implement __eq__ and __hash__ for PsSymbol

parent e842ed85
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,16 @@ class PsSymbol:
raise PsInternalCompilerError("Symbol had no type assigned yet")
return self._dtype
def __eq__(self, other: object) -> bool:
return (
type(self) == type(other)
and self._name == other._name
and self._dtype == other._dtype
)
def __hash__(self) -> int:
return hash((self._name, self._dtype))
def __str__(self) -> str:
dtype_str = "<untyped>" if self._dtype is None else str(self._dtype)
return f"{self._name}: {dtype_str}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment