[Bug]: Slither does not distinguish between types and type expressions
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the issue:
Slither doesn't distinguish between type expressions, of which `uint[NUM_PHASES]` is a member, and types, of which `uint[NUM_PHASES]` is not a member but `uint[3]` is. This causes it to miss applications of using/for.
In the example source, Slither does not convert the type expression `uint[NUM_PHASES]` to the type `uint[3]`, and so IR generation is unable to recognize `z.proj0` as a library call.
### Code example to reproduce the issue:
```
library Lib {
function proj0(uint[3] memory a) external returns(uint) {
return a[0];
}
}
contract Test {
uint constant NUM_PHASES = 3;
using Lib for uint[3];
function test(uint[NUM_PHASES] memory z) external {
z.proj0();
}
}
```
### Version:
0.9.6
### Relevant log output:
```shell
INFO:Printers:Contract Lib
Function Lib.proj0(uint256[3]) (*)
Expression: a[0]
IRs:
REF_0(uint256) -> a[0]
RETURN REF_0
Contract Test
Function Test.test(uint256[3]) (*)
Expression: z.proj0()
IRs:
TMP_0(None) = HIGH_LEVEL_CALL, dest:z(uint256[3]), function:proj0, arguments:[]
Function Test.slitherConstructorConstantVariables() (*)
Expression: NUM_PHASES = 3
IRs:
NUM_PHASES(uint256) := 3(uint256)
```
Contributor guide
Assessment
This issue has not been assessed yet.