Skip to content

Commit 53124e6

Browse files
committed
fix: resolve shadowed modifiers via IdentifierPath referencedDeclaration
Only skip the is_shadowed check when resolving via IdentifierPath (e.g. A.m in a modifier reference), preserving existing behavior for regular identifier lookups where shadowed functions should fall through to virtual resolution. Fixes #2838
1 parent c7f761a commit 53124e6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

slither/solc_parsing/expressions/find_variable.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def _find_variable_from_ref_declaration(
5555
all_functions: list["Function"],
5656
function_parser: Optional["FunctionSolc"],
5757
contract_declarer: Optional["Contract"],
58+
is_identifier_path: bool = False,
5859
) -> Contract | Function | None:
5960
"""
6061
Reference declarations take the highest priority, but they are not available for legacy AST.
@@ -77,7 +78,9 @@ def _find_variable_from_ref_declaration(
7778
if contract_candidate and contract_candidate.id == referenced_declaration:
7879
return contract_candidate
7980
for function_candidate in all_functions:
80-
if function_candidate.id == referenced_declaration and not function_candidate.is_shadowed:
81+
if function_candidate.id == referenced_declaration and (
82+
is_identifier_path or not function_candidate.is_shadowed
83+
):
8184
return function_candidate
8285
return None
8386

@@ -445,6 +448,7 @@ def find_variable(
445448
direct_functions,
446449
function_parser,
447450
contract_declarer,
451+
is_identifier_path,
448452
)
449453
if ret0:
450454
return ret0, False

0 commit comments

Comments
 (0)