occurrences: Replace machinery-ref heuristics with JL's synthetic_ref#646
Open
aviatesk wants to merge 1 commit into
Open
occurrences: Replace machinery-ref heuristics with JL's synthetic_ref#646aviatesk wants to merge 1 commit into
synthetic_ref#646aviatesk wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #646 +/- ##
==========================================
- Coverage 75.39% 75.27% -0.12%
==========================================
Files 58 58
Lines 10915 10865 -50
==========================================
- Hits 8229 8179 -50
Misses 2686 2686
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aviatesk
force-pushed
the
avi/occurrence-analysis-refactoring
branch
3 times, most recently
from
April 29, 2026 06:18
11f19ff to
e4228c6
Compare
aviatesk
force-pushed
the
avi/occurrence-analysis-refactoring
branch
from
May 2, 2026 13:31
e4228c6 to
92d656c
Compare
aviatesk
force-pushed
the
avi/occurrence-analysis-refactoring
branch
4 times, most recently
from
May 15, 2026 17:03
a296daf to
29dc2fc
Compare
JuliaLowering now tags machinery references (function self-refs inside `K"method"` / `K"function_type"` / `K"removable"`, kwsorter body forwards, optional-positional self-forwarding stubs, type self-refs in `_typebody!` / `_equiv_typedef` calls, etc.) with `:synthetic_ref` metadata. Replace the JETLS-side heuristic layer that approximated this with a single metadata check when recording `:use` occurrences. Removed: the `SkipRecording` byte-range map, the `K"block" [K"function_decl" …]` traversal that registered ranges, `is_selffunc` / `is_kwsorter_func` / `kwerr` arg-skipping, and the struct-name `:local` rhs-pattern check. Net ~130 lines out of `occurrence-analysis.jl`. Also tighten the `:local (mod=nothing)` → `:global` alias merge for type definitions to discriminate by declaration `byte_range` rather than by `is_internal` + name, so an unrelated `local Foo` / `let Foo = 1` sharing a name is not merged. Regression coverage in `test/analysis/test_occurrence_analysis.jl`: function / macro / type definitions produce no spurious `:use` of their own name, and user-written refs inside machinery positions (self-recursive calls, dependent defaults in optional / keyword args and inner constructors) are still counted correctly.
aviatesk
force-pushed
the
avi/occurrence-analysis-refactoring
branch
from
May 16, 2026 16:27
29dc2fc to
87f0059
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.
JuliaLowering now tags machinery references (function self-refs inside
K"method"/K"function_type"/K"removable", kwsorter body forwards, optional-positional self-forwarding stubs, type self-refs in_typebody!/_equiv_typedefcalls, etc.) with:synthetic_refmetadata. Replace the JETLS-side heuristic layer that approximated this with a single metadata check when recording:useoccurrences.Removed: the
SkipRecordingbyte-range map, theK"block" [K"function_decl" …]traversal that registered ranges,is_selffunc/is_kwsorter_func/kwerrarg-skipping, and the struct-name:localrhs-pattern check. Net ~130 lines out ofoccurrence-analysis.jl.Also tighten the
:local (mod=nothing)→:globalalias merge for type definitions to discriminate by declarationbyte_rangerather than byis_internal+ name, so an unrelatedlocal Foo/let Foo = 1sharing a name is not merged.Regression coverage in
test/analysis/test_occurrence_analysis.jl: function / macro / type definitions produce no spurious:useof their own name, and user-written refs inside machinery positions (self-recursive calls, dependent defaults in optional / keyword args and inner constructors) are still counted correctly.