Repository navigation
calls_out (Go): throw( is a call, and (*T)(x) conversions are calls - #3722
Merged
Merged
Conversation
…3645) - `throw` leaves the global keyword ignore set: go's runtime `throw("...")`, matlab's and haskell's are functions. It moves into `_calls_out_ignore` of each calls_out language where it is a keyword (apex, cpp, csharp, dart, groovy, java, javascript, kotlin, livecode, objective-c, php, scala, solidity, swift, typescript; powershell already had it). C macro bodies in wrapper_extractor keep ignoring it. - go gets CALLS_OUT_GO: a conversion to a parenthesized type, `(*T)(x)`, `(**g)(p)`, `(*[2]Timeval)(p)`, `(*unsafe.Pointer)(p)`, is a call to the type (qualifier `unsafe`). The plain `name(` form no longer consumes its `(`, so `return (*m)(p)` still sees the conversion. `h(next)(w)` records only `h`. call_graph_accuracy (go): recall 96.4% -> 99.6% (FN 239 -> 29), precision 99.9% unchanged; no other language moved. Goldens: proc.go gains one downstream edge (popularity, blast radius, composition fit), plus the network-wide averages and PageRank ripple. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
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.
Summary
Fixes #3645 (part of #3641). The engine missed two kinds of Go call.
1.
throwwas ignored in every language._CALLS_OUT_GLOBAL_IGNORElistedthrowbecause it is a keyword in C++, Java and JS. But Go's runtimethrow("…")is a real function (runtime/panic.go), and so are MATLAB's and Haskell's, so every one of those calls was lost. Contract C2 says keywords are per language, sothrowmoves into_calls_out_ignoreof each calls_out language where it is a keyword: apex, cpp, csharp, dart, groovy, java, javascript, kotlin, livecode, objective-c (@throw), php, scala, solidity, swift and typescript. PowerShell already listed it. C/C++ macro bodies inwrapper_extractorkeep ignoring it.2. Go conversions to a parenthesized type.
(*gcBgMarkWorkerNode)(nodep)and(*uintptr)(unsafe.Pointer(p))are conversions, and a conversion is a call (C3). But\b(name)\s*\(can't see past the). Go now has its own pattern,CALLS_OUT_GO, registered inQUALIFIED_CALLS_OUT_PATTERNS:(*T)(,(**T)(,(*[N]T)(and(*pkg.T)(. The callee isT, andpkgbecomes its qualifier, the way tree-sitter names it.name(form no longer consumes its(. Before this,return (*m)(p)swallowed the conversion's opening paren, sincereturn (looked like a call.(right after a name,)or]is not treated as a conversion. Soh(next)(w, r), a call of the functionhreturns, records onlyhand nevernext.docs/calls_out_rule_contract.mdC2 and C3 record both decisions.Type of change
gitgalaxy/core/detector.py,language_standards.py,prism.py, or a per-language rule)CI checklist
python tests/tools/audit_check.pypasses (bundles the ruff/mypy/dead-key baseline-gated audits +ruff format --check)python -m pytest tests/passespython tests/tools/crucible_check.pypasses. Both fixtures were re-blessed; see below.tree_sitter_accuracy_audit.py --all --ci: not run locally. It scores functions, classes and args, which this PR doesn't touch; CI runs it.Measurements
call_graph_accuracy.py(Level 1, against tree-sitter), on language-crucible v1.5.0:No other language moved. The baseline is regenerated.
Of the 29 Go misses left, 26 are
defer func(){…}()/go func(){…}(). For those, the tree-sitter side names an identifier inside the anonymous function as the callee: a quirk of the reference tool, not an engine miss.Golden masters, scoped diff: 7 differences, identical in both modes, all from Go.
go/core/proc.gogains one downstream file edge from the calls it now sees (conversions to types defined in other files, andthrow). That moves its:server.go's composition fit moves (0.836 → 0.856).undocumented_critical_pathshift.keyword-rosetta:
rosetta_audit.pyfinds 51 languages, 0 regressions. No non-keyword language in the corpus writesthrow(.Differential Scan target
language-crucible
go/core(golang runtime:proc.go,mgc.go,value.go,syscall_linux.go).Verification
New tests:
tests/extraction/languages/test_calls_out_go_3645.py, which covers:throwas a call, andthrowstaying a keyword in each of the 16 keyword languages;test_calls_out_generics_3644.pyno longer expects Go to use the plain C-style pattern.🤖 Generated with Claude Code
https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
Generated by Claude Code