[Bug]: incorrect IR for array initialization
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the issue:
When declaring a new array variable using another previously defined array variable, `InitArray` IR operation is used, which is incorrect.
To my understanding, `InitArray` only represents initializing an array literal by listing its elements.
In the example code below, `Assignment` IR operation should be used instead of `InitArray`.
### Code example to reproduce the issue:
```solidity
contract Contract {
function foo(uint[] memory arr) public {
uint[] memory arr2 = arr;
}
}
```
### Version:
0.9.3
### Relevant log output:
```shell
INFO:Printers:Contract Contract
Function Contract.foo(uint256[]) (*)
Expression: arr2 = arr
IRs:
arr2(uint256[]) = ['arr'] # InitArray operation, which is incorrect
```
Contributor guide
Assessment
This issue has not been assessed yet.