Commit c1b00b4
Fix dead-code detector incorrectly flagging library functions (#2905)
* fix: exclude library functions from dead-code detector
The dead-code detector incorrectly flagged library functions as dead code.
This fix updates the type annotation and set comprehension to properly
track library function canonical names.
Also adds test case and snapshot for library function usage.
Fixes #1265
* fix: address PR review feedback
- Remove unused Contract import from dead_code.py
- Fix misleading comment in test file that claimed unused library
function should be flagged (library functions are excluded from
dead-code detection)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
---------
Co-authored-by: ep0chzer0 <[email protected]>
Co-authored-by: Dan Guido <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>1 parent d58413c commit c1b00b4
File tree
5 files changed
+49
-5
lines changed- slither/detectors/functions
- tests/e2e/detectors
- snapshots
- test_data/dead-code/0.8.0
5 files changed
+49
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 59 | + | |
62 | 60 | | |
63 | 61 | | |
64 | 62 | | |
| |||
Whitespace-only changes.
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1361 | 1361 | | |
1362 | 1362 | | |
1363 | 1363 | | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1364 | 1369 | | |
1365 | 1370 | | |
1366 | 1371 | | |
| |||
0 commit comments