From 8d9e162eb368ce4967f432ac776a15ee4acf1862 Mon Sep 17 00:00:00 2001 From: Josselin Date: Sun, 14 Feb 2021 18:30:50 +0100 Subject: [PATCH] User __str__ for top level user defined type (fix #773) --- slither/core/solidity_types/user_defined_type.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/slither/core/solidity_types/user_defined_type.py b/slither/core/solidity_types/user_defined_type.py index 75a44e10f..cecbec449 100644 --- a/slither/core/solidity_types/user_defined_type.py +++ b/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):