Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Troublor committed Mar 17, 2023
1 parent 387c02d commit a6591e9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion slither/slithir/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,13 @@ def propagate_types(ir: Operation, node: "Node"): # pylint: disable=too-many-lo
if v:
ir.lvalue.set_type(v.type)
elif isinstance(ir, NewArray):
ir.lvalue.set_type(ir.array_type)
# Reconstruct the array type from base type and depth
# Note that the length of the array type is lost since NewArray expression does not store it.
# So, here we over-approximately set the length to None (dynamic array).
typ = ir.array_type
for _ in range(ir.depth):
typ = ArrayType(typ, None)
ir.lvalue.set_type(typ)
elif isinstance(ir, NewContract):
contract = node.file_scope.get_contract_from_name(ir.contract_name)
ir.lvalue.set_type(UserDefinedType(contract))
Expand Down

0 comments on commit a6591e9

Please sign in to comment.