User __str__ for top level user defined type (fix #773)

pull/786/head
Josselin 4 years ago
parent 119a024b58
commit 8d9e162eb3
  1. 11
      slither/core/solidity_types/user_defined_type.py

@ -59,12 +59,13 @@ class UserDefinedType(Type):
raise SlitherException(to_log)
def __str__(self):
from slither.core.declarations.structure import Structure
from slither.core.declarations.enum import Enum
from slither.core.declarations.structure_contract import StructureContract
from slither.core.declarations.enum_contract import EnumContract
if isinstance(self.type, (Enum, Structure)):
return str(self.type.contract) + "." + str(self.type.name)
return str(self.type.name)
type_used = self.type
if isinstance(type_used, (EnumContract, StructureContract)):
return str(type_used.contract) + "." + str(type_used.name)
return str(type_used.name)
def __eq__(self, other):
if not isinstance(other, UserDefinedType):

Loading…
Cancel
Save