Skip to content

Commit

Permalink
add bug-revealing test for crytic#1776
Browse files Browse the repository at this point in the history
  • Loading branch information
Troublor committed Mar 17, 2023
1 parent 776dcab commit 387c02d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_ssa_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Union, List, Optional

import pytest
from slither.core.solidity_types import ArrayType
from solc_select import solc_select
from solc_select.solc_select import valid_version as solc_valid_version

Expand Down Expand Up @@ -1077,3 +1078,20 @@ def test_issue_1748():
operations = f.slithir_operations
assign_op = operations[0]
assert isinstance(assign_op, InitArray)


def test_issue_1776():
source = """
contract Contract {
function foo() public returns (uint) {
uint[] memory arr = new uint[](2);
return 0;
}
}
"""
with slither_from_source(source) as slither:
c = slither.get_contract_from_name("Contract")[0]
f = c.functions[0]
operations = f.slithir_operations
assign_op = operations[0]
assert isinstance(assign_op.lvalue.type, ArrayType)

0 comments on commit 387c02d

Please sign in to comment.