fix(registry): restrict same-module suffix resolution to self/namespace receivers#893
Open
sahil-mangla wants to merge 1 commit into
Open
fix(registry): restrict same-module suffix resolution to self/namespace receivers#893sahil-mangla wants to merge 1 commit into
sahil-mangla wants to merge 1 commit into
Conversation
… receivers Limit same-module suffix fallback in resolve_same_module to only fire if the receiver is a self-receiver or matches the module/namespace. Also reject matching dotted/colon-qualified callees targeting a Function to a different prefix in name lookup. This prevents false-positive recursion flags on store/delegation calls. Signed-off-by: sahil-mangla <manglasahil2017@gmail.com>
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.
What does this PR do?
This PR fixes #876 false-positive recursion flags (
unguarded_recursion,self_recursive,recursive) occurring on store wrappers, singleton delegations, and other method calls targeting unrelated objects that happen to share a name with a top-level function in the current module (e.g._get_store().get(...)insideget(...)or_default.check(...)insidecheck(...)).Root Cause
During call graph resolution in Strategy 2 (
resolve_same_moduleinsrc/pipeline/registry.c), dotted/colon-separated callee names (like_default.check) were split intoprefix(_default) andsuffix(check). The resolver fell back to checking if the suffix exists as a top-level function in the caller's module (module_qn.check). If a localcheckfunction was defined, it matched and mistakenly resolved the call to it, generating a self-loopCALLSedge which flagged the function as recursive.Solution
is_same_module_receiverto validate the receiver prefix. Suffix fallback checks inresolve_same_moduleare now restricted to:"self","this","cls","@self"..<prefix>).axios.get,_get_store().get,_default.check) from matching same-module top-level functions, eliminating spuriousCALLSself-loops.tests/test_registry.c(resolve_same_module_only_on_self_receiver) to cover delegation, self, and namespace/module receiver pattern cases.Checklist
git commit -s) — required, CI rejects unsigned commits (DCO, see CONTRIBUTING.md)make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)