handle constant conversionn of type alias

pull/1271/head
alpharush 2 years ago
parent 378f5373f3
commit 57cbafa51d
  1. 5
      slither/slithir/convert.py
  2. 2
      tests/ast-parsing/user_defined_value_type/constant-0.8.9.sol

@ -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):

@ -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;
Loading…
Cancel
Save