Repository navigation
Resolver: a bare Perl call to a built-in is the built-in (#3401) - #3444
Merged
Merged
Conversation
Mojo's Promise.pm defines `sub map`. Every bare `map(` in bugzilla and spamassassin (language-crucible) resolved `unique` to it, a confident edge into a different repository, which inflated Promise.pm's Popularity Rank from 7 to 12. Perl's named operators and built-in functions take precedence over a user sub of the same name; that sub is reachable only as `$x->map`, `&map` or `Mojo::Promise::map`. call_resolver: _BARE_BUILTINS[lang] lists the names a bare call always means as the built-in. For such a call the resolver returns step none/external, as for any library call. Only Perl is listed. Languages where a definition can shadow a built-in (Python, Lua, JS) are not, so redis's global `function printf` still resolves (test). Golden masters re-blessed: 10 substantive differences. Promise.pm Popularity Rank and blast radius 12 -> 7, restoring the pre-#3361 value; the rest are composition z-scores and network_macro ripples. call_graph_accuracy --ci within tolerance; ground-truth ledger unchanged. The broader cross-package `unique` problem (bare `remove`/`all` into Mojo) and the unattributed Swift row are filed as #3443. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
…l-to-method-3401 # Conflicts: # tests/golden_master_audit/2_global_ecosystem_summary/network_macro.json # tests/golden_master_audit/4_high_value_forensic_report/systemic_bottlenecks.json # tests/golden_master_zero_dep_audit/2_global_ecosystem_summary/network_macro.json # tests/golden_master_zero_dep_audit/4_high_value_forensic_report/systemic_bottlenecks.json
Contributor
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.
Closes #3401. The broader part is split out as #3443.
What was actually wrong
I measured each of #3401's rows on today's main:
sub map(Popularity 7 → 12)map(in bugzilla and spamassassin resolveduniqueto Mojo's sub, which sits in a different repository. Perl's named operators take precedence over a user sub of the same name: that sub is reachable only as$x->map,&maporMojo::Promise::map.func map(4 → 5)mapedge. The method hasparent_class_nameDataResponse/DownloadResponse, so a bare call can't reach it (bucket.freeexcludes owned methods). A call inside an extension of that type resolves throughclass, which is correct. The golden popularity comes from edges in the whole-crucible scan that I didn't attribute; they're noted in #3443.function printf(0 → 3)printfbuilt-in, so it's a real global. Kept (test).pub fn loglogisstd.log, qualified. Unchanged.Fix (
call_resolver.py)_BARE_BUILTINS[lang]lists the names that a bare call always means as the language's built-in. For such a call the resolver returnsnone/external, as it does for any library call, even in the file that defines a same-named sub.Checks
network_macroripples.call_graph_accuracy.py --ci --samples 8: OK, no language dropped beyond tolerance.remove(×2 andall(×1 still resolveuniqueinto Mojo. That's the general "a bare call in a package-scoped language resolves to a definition it can't see" problem. It affects Python and JS/TS too and needs its own golden-master measurement.Test plan
test_bare_perl_builtin_never_links_to_a_same_named_sub(cross-repo and same-file) andtest_a_redefinable_name_still_resolves(Luaprintf): 28 passed intest_call_resolver.pypytest tests/: 11,108 passed🤖 Generated with Claude Code
https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g