fix: resolve shadowed modifiers via IdentifierPath#2992
Open
cats2101 wants to merge 1 commit intocrytic:masterfrom
Open
fix: resolve shadowed modifiers via IdentifierPath#2992cats2101 wants to merge 1 commit intocrytic:masterfrom
cats2101 wants to merge 1 commit intocrytic:masterfrom
Conversation
Author
|
Gentle ping — anything else needed here? |
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 crytic#2838
be3cb25 to
53124e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2838
When a modifier is referenced via
IdentifierPath(e.g.A.minfunction f() public A.m), the compiler resolves the exact declaration id viareferencedDeclaration. However,_find_variable_from_ref_declarationwas filtering out matches whereis_shadowedis true — which incorrectly rejected parent modifiers that are overridden by a child contract.Since
referencedDeclarationis the compiler's authoritative resolution, we should trust it without filtering byis_shadowed. The shadowed filter is appropriate for name-based lookups (where you want the most-derived version), but not when looking up by compiler-resolved id.Before
After
Parses correctly, no error.
Reproducer
Test plan