diff --git a/slither/core/slither_core.py b/slither/core/slither_core.py index d22f5ae0f..8eca260fa 100644 --- a/slither/core/slither_core.py +++ b/slither/core/slither_core.py @@ -208,7 +208,7 @@ def _compute_offsets_from_thing(self, thing: SourceMapping): for offset in range(definition.start, definition.end + 1): if ( - isinstance(thing, TopLevel) + isinstance(thing, (TopLevel, Contract)) or ( isinstance(thing, FunctionContract) and thing.contract_declarer == thing.contract diff --git a/tests/unit/core/test_virtual_overrides.py b/tests/unit/core/test_virtual_overrides.py index f2c6b2e3d..a5ca4a865 100644 --- a/tests/unit/core/test_virtual_overrides.py +++ b/tests/unit/core/test_virtual_overrides.py @@ -5,6 +5,7 @@ def test_overrides(solc_binary_path) -> None: + # pylint: disable=too-many-statements,too-many-locals solc_path = solc_binary_path("0.8.15") slither = Slither(Path(TEST_DATA_DIR, "virtual_overrides.sol").as_posix(), solc=solc_path)