Repository navigation
calls_out (cpp/ts/c#): catch generic calls, drop Class::method self-headers, name the type in Type var( (#3644) - #3683
Merged
Conversation
…var( (#3644) - CALLS_OUT_C_STYLE_GENERIC steps over one nested level of type arguments before the (: static_cast<int>(, Object::cast_to<T>(, new Array<T>(). Bounded, one line, no ( ) ; { } = | ! ? or quote inside; only cpp, typescript and csharp use it. - A Class::method unit drops its leaf name when the call is bare, this- or own-class-qualified (its own header and its recursion); child->method( stays. call_graph_accuracy.py's tree-sitter side applies the same rule. - C++ Type var(args) in a body names the type as the callee (C3); a built-in type or a pointer/reference declarator calls nothing. call_graph_accuracy on language-crucible: cpp precision 87.7 -> 96.5, recall 95.6 -> 99.3; typescript recall 95.1 -> 97.2; csharp recall 97.6 -> 99.8. Baseline regenerated, shapes merged into the ledger. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
Type var( (#3644)
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 #3644 (part of #3641). Three
calls_outdefects, all validated shapes indocs/self_scan/graph_comparison_ledger.json:1. Generic calls were missed (C3). A type-argument list between the callee and
(defeated\b(name)\s*\(. Examples:static_cast<int>(,Object::cast_to<EditorDock>(,back_inserter<vector<wstring> >(, TS/C#new Array<T>().CALLS_OUT_C_STYLE_GENERICin_shared_patterns.py. It allows an optional<…>right after the name (no blank, so a spaced comparisona < bnever opens one).( ) ; { } = | ! ?or quotes. It ends in>then(.QUALIFIED_CALLS_OUT_PATTERNS, so qualifier capture and the C5/C8 checks apply. Only cpp, typescript and csharp switch to it; every other language keepsCALLS_OUT_C_STYLE.2. An out-of-class
Class::methodheader was a call tomethod(793 occurrences, the ledger's largest shape). Self-removal compared the qualified unit name with the bare callee, so it never matched. A qualified unit now drops its leaf name when the call is bare,this->/self.-qualified or qualified by its own class. That covers its own header and its recursion.child->method(is another object's method and stays a call.child->getTextInRange(…)-style calls, so the rule is receiver-aware.3. C++
Type var(args)took the variable as the callee (C3). Examples:EditorProgress progress(…),MutexLock lock(m). The callee is now the type. Details:;,{or}, decl-specifiers likestatic/constallowed), and only the body is read. Soreturn f(x),a = b(c), keywords (new,throw, …) and the unit's ownStatus run(header are untouched.int n(5)) or a pointer/reference declarator (Foo* p(q)) calls nothing, so nothing is recorded.calls_out_declarator_constructsflag incpp.py, outsiderulesper orphaned_logic reports 100% dead code for five languages whose invocation model never names the callee — the family #2727 closed without covering #2806.>of->never closes a template. The measurement caughti < renderer->get_item_count()being read as a declaration ofi, and a test now covers it.Truth side (
tests/tools/call_graph_accuracy.py). The tree-sitter side dropped only the unit's full (qualified) name, so it counted real C++ recursion (deleteSubtree(child)insideBuffer::deleteSubtree) as an engine miss. It now applies the same receiver-aware leaf rule, the same kind of truth-side fix as #3666. There's a new test intests/tools/test_call_graph_accuracy.py.Type of change
detector.py,_shared_patterns.py, cpp/typescript/csharp profiles)Measured:
call_graph_accuracy.pyon language-crucible v1.5.0Shapes from the issue:
qualified_identifier<function_declarator(own header)template_function+genericqualified_identifier+genericfield_expression+genericinit_declarator<declaration(Type var()engine-attributes-to-another-function(new Array<T>())generic_name/member_access+generic/object_creation+genericMoved, not removed: cpp
declaration<compound_statementwent 7 → 59. These are theType var(sites now reporting the type (wistringstream s(attribs)→wistringstream), as the validated verdict asks. Tree-sitter has no call node for a declaration, so they count as engine-only until that shape gets its own ledger verdict.Known gap: type arguments nested two levels deep (
make<vector<vector<int>>>() are still missed. That keeps the pattern bounded, and a test pins it.tests/call_graph_accuracy_baseline.jsonis regenerated and the shapes are merged into the ledger with--ledger. No verdict was hand-edited.Golden masters
crucible_check.py --mode both --update --yesreports no drift in either fixture. The golden masters don't record callee names, and the idiom-wrapper call-site counts they do record didn't move.Verification
🤖 Generated with Claude Code
https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr