diff --git a/slither/slithir/convert.py b/slither/slithir/convert.py index 2d5f7ad35..0e2311f69 100644 --- a/slither/slithir/convert.py +++ b/slither/slithir/convert.py @@ -1667,7 +1667,10 @@ def convert_constant_types(irs): if isinstance(ir.rvalue, TupleVariable): # TODO: fix missing Unpack conversion continue - if ir.rvalue.type.type not in ElementaryTypeInt: + if isinstance(ir.rvalue.type, TypeAlias): + ir.rvalue.set_type(ElementaryType(ir.lvalue.type.name)) + was_changed = True + elif ir.rvalue.type.type not in ElementaryTypeInt: ir.rvalue.set_type(ElementaryType(ir.lvalue.type.type)) was_changed = True if isinstance(ir, Binary): diff --git a/tests/ast-parsing/user_defined_value_type/constant.sol b/tests/ast-parsing/user_defined_value_type/constant-0.8.9.sol similarity index 88% rename from tests/ast-parsing/user_defined_value_type/constant.sol rename to tests/ast-parsing/user_defined_value_type/constant-0.8.9.sol index 0cab2a6f3..70b395441 100644 --- a/tests/ast-parsing/user_defined_value_type/constant.sol +++ b/tests/ast-parsing/user_defined_value_type/constant-0.8.9.sol @@ -1,5 +1,5 @@ type T is int224; -pragma solidity >= 0.8.12; +pragma solidity ^0.8.9; contract C { T constant public s = T.wrap(int224(165521356710917456517261742455526507355687727119203895813322792776)); T constant public t = s;