diff --git a/slither/detectors/functions/dead_code.py b/slither/detectors/functions/dead_code.py index 1d5fe05e8..5d632b9f9 100644 --- a/slither/detectors/functions/dead_code.py +++ b/slither/detectors/functions/dead_code.py @@ -68,6 +68,9 @@ contract Contract{ function.contract_declarer.is_from_dependency() ): continue + # Continue if the functon is not implemented because it means the contract is abstract + if not function.is_implemented: + continue info = [function, " is never used and should be removed\n"] res = self.generate_result(info) results.append(res) diff --git a/tests/detectors/dead-code/0.8.0/dead-code.sol b/tests/detectors/dead-code/0.8.0/dead-code.sol index 050793f9d..309c8fb76 100644 --- a/tests/detectors/dead-code/0.8.0/dead-code.sol +++ b/tests/detectors/dead-code/0.8.0/dead-code.sol @@ -27,3 +27,7 @@ contract Test4 is Test2{ } } + +abstract contract Test5 { + function unused_but_abstract() internal virtual; +}