Repository navigation
Call graph: typing and overloads — receiver typing (C++/Go/Rust/TS), Java overloads by argument type, C++ arity ranges and ctor edges, Python property reads, renamed imports (Part of #8161) - #8190
Merged
Conversation
…tion or field reaches its class's method (X3, Part of #8161) core/receiver_types.py reads, from the calling unit and its file: parameters and locals with a written type, locals bound to a construction (T::new(), T { }, &T{}, new(T), new T(), T x;, auto x = T(), make_unique<T>()), and struct/class fields for self.x / this.x (C++: a bare name no local declares). The resolver's typed step then links x.m() to that class's method. Go keeps a package qualifier (x *pkg.T resolves in that package only); Rust's Self is the caller's own type; C++/TS/JS take a typed class only when it is in a file the caller sees. Gate (confident precision / recall): cpp 89.1/35.9 -> 89.9/39.4; go 99.5/74.8 -> 99.6/77.8; rust 98.3/78.0 -> 98.3/81.5; ts 100/82.3 -> 100/82.3; js unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…k runs and unclosed openers (X3, Part of #8161) 0925b711c's scans were quadratic on adversarial text, which #3772's linear-time test caught (an unterminated namespace opener shields to one word and a long blank run): - C++: adjacent backtracking blank runs in the declaration pattern (`[ \t]*(?:<..>)?` then `[ \t\r\n]*`) split a long run every way; blank runs are now possessive, the optional template arguments own the blanks before them, and a match starts only at a word or `::`. - Rust: the blanks after a `:` and around an optional `&` were the same shape. - TypeScript: the parameter pattern's leading `^[ \t\r\n]*` (re.M) rescanned a blank run from every line start; the match now starts at the name and `_ts_params` checks the lead (`(`, `,` or a line start) by walking back once. - Go / TS / Rust fields: each unclosed struct/class opener scanned to the end of the file; brace matches now come from one stack pass (`_brace_closes`). Test: test_declaration_scans_are_linear (5 adversarial shapes x 4 languages). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…t of #8161) Regenerated with `tests/tools/call_graph_resolution.py <lang> --regenerate` (confident precision / recall): cpp 89.1/35.9 -> 89.9/39.4; go 99.5/74.8 -> 99.6/77.8; rust 98.3/78.0 -> 98.3/81.5. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
… (X3, Part of #8161) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…8161) core/java_arg_types.py: the detector records each call site's argument types (literals, typed locals / parameters / fields with primitives and arrays, `new T(..)`, `new T[..]`, casts of a plain operand, `xs.length`, `null`) as calls_out_arg_types and each method's declared param_types, both read from the unit's source with literals blanked to the same length (the engine's shield shortens 'c' and "c" alike to ""). The resolver's _choose_overloads picks, per call site, the overload Java picks (JLS 15.12.2: strict, then loose invocation, then the most specific method), and only when certain: every argument typed, every candidate's parameters read, no candidate only maybe applicable. Repo classes decide subtyping by their lineage; a final JDK class (String, the boxes) has known supertypes; a type variable's bound is unread, so it decides nothing. A site it cannot decide keeps the `overload` row. New function_data columns calls_out_arg_types and param_types (JSON; recorded, healed and rehydrated). Stricter than the gaps/java-tools prototype (which cost 0.4 pp): unknown arguments never pass. Gate (java, gson vs scip-java): recall 72.9 -> 82.5; confident precision 99.8 -> 99.8 (6480 agree / 15 wrong, was 5729 / 12): the 3 new wrong-overload links are one test helper, roundTrip(Gson, Gson, ProtoWithAnnotationsAndJsonNames), whose argument is a protobuf-generated type scip-java did not attribute; by the source they are right. Extraction cost on gson's 40 largest files: about +7%. Tests: test_java_overload_types_8161.py; test_fcall_data round trip; the J2 guess test now uses an argument with no readable type. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
… Part of #8161) Regenerated with `call_graph_resolution.py java --regenerate`: recall 72.9 -> 82.5, confident precision 99.8 (wrong-overload 0 -> 3, see the J1 commit). Also a mypy fix: the unit's own-name list no longer reuses a frozenset-typed name. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…and variadics (P5, Part of #8161) A default argument lowers the fewest arguments an overload takes and a variadic (`...`, a top-level pack `Ts&&... xs`; `format_string<T...>` is none) has no most. The detector records a definition's own range (function_data.arity_range) and, per class, its member declarations' ranges (class_data.method_arities): an out-of-line definition repeats no default, so `Printer::emit(int a, int b)` takes the range its class declares (`void emit(int a, int b = 0);`). The resolver picks by tier: an exact parameter count first (#3835, unchanged), else an overload that takes the count through its defaults, else a variadic; several in the winning tier stay ambiguous. Both columns are recorded, healed and rehydrated (test_fcall_data). An exact count still beats a default (s04 `p.emit(1)` -> `emit(const char*)`): ranking a default as ambiguous measured 92.6 / 35.7 on fmt (precision up, recall down 3.7 pp, the gate fails), because fmt's defaulted overloads lose to the exact one far more often than not; only C++ argument types can settle that case. Gate (cpp, fmt vs libclang, confident precision / recall): 89.9 / 39.4 -> 90.0 / 39.8. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
Regenerated with `call_graph_resolution.py cpp --regenerate`: confident precision / recall 89.9 / 39.4 -> 90.0 / 39.8. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…; `T x(a)` counts its arguments (P3, Part of #8161) Owner decision: such an edge is its own kind, never folded into `call`. core/cpp_ctor_forms.py reads, from a unit's body, `T x;`, `T x{a, b};`, `T x = lit;` (a declaration opening a statement, no `*`/`&` declarator) and `make_unique<T>(..)` / `make_shared<T>(..)`, with their argument counts (function_data.ctor_forms, recorded, healed, rehydrated). The resolver links each to the class's own constructor, chosen by count like a call, as an fcall row of kind `ctor`; a class with no constructor of its own gets no row. Written constructions (`T x(a)`, `T(a)`, `new T(a)`) stay `call` (contract C3); `T x(a)` now records its count at the declarator's `(` (it was read at the type, so it was None). arity_range now also carries the header's own parameter count when the `args` metric misreads it (`const Allocator& alloc = Allocator()` counted 6), and the resolver uses it: fmt's `basic_memory_buffer buf(alloc)` no longer links the move constructor. The resolution gate reports the `ctor` kind (by_fcall_kind; labelled-kinds and all-kinds recall count it); gated numbers stay confident `call` edges. Docs: the edge kind table and the contract's open-question row. Gate (cpp, fmt vs libclang): call 90.0 / 80.1 / 39.8 -> 90.2 / 80.3 / 39.6 (confident precision / strict / recall; wrong 147 -> 142); ctor 21 judged, 95.2%; the reference's ctor edges linked 16.5% -> 17.3%; labelled-kinds recall 10.9 -> 11.3. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
… of #8161) A property read runs the getter, but only a value-position `self.p` was recorded (as a `reference`): chains (`self.conn.batches`), conditions, subscripts and call receivers gave no edge. The detector now records every attribute read off `self` / `cls` that is neither called nor assigned (function_data.property_reads; recorded, healed, rehydrated). The resolver keeps one only when it reaches, through the class or typed step, a method decorated `@property`, `@cached_property` or `@x.getter` (a setter sharing the name maps to its getter), as a `call` row; data attributes get no row. A value-position read of a property is that call, no longer a `reference`; a plain method read as a value stays a `reference`. Gate (python, confident precision / recall): 99.9 / 52.8 -> 99.9 / 54.8; flask import-graph lane 99.4 / 41.2 -> 99.4 / 43.5. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
#8161) Regenerated with `call_graph_resolution.py python --regenerate`: python recall 52.8 -> 54.8, flask import-graph lane 41.2 -> 43.5; confident precision unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
… imported definition (X5, Part of #8161) core/import_renames.py reads a file's renamed imports (`import { add as plus2 }`, `from m import f as g`, `use a::b as c` and brace groups); default and namespace imports and module aliases are not renames of a definition. The detector records, per unit, the bare callees that use one (function_data.calls_out_renames; recorded, healed, rehydrated), and the resolver looks such a call up under the imported name, so `plus2()` links to `add` through the import step instead of giving no row. A name bound to two different imports is left alone. Gates (all --ci pass, confident precision unchanged): typescript recall 82.3 (+1 agree), javascript 87.9, python 54.8, rust 81.5: the gate corpora rarely rename an import. zod's 66 renamed-export misses come from re-exports (`export { _gte as gte }` in a barrel), which need a per-file export map: a follow-up. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…art of #8161) Regenerated with `call_graph_resolution.py cpp --regenerate`: confident precision / recall 90.0 / 39.8 -> 90.2 / 39.6 (wrong 147 -> 142). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…ust rename pattern passes xray (Part of #8161) - J1: the one-pass call-name index reads ASCII-led identifiers, so a method named with combining marks or a ZWJ (`probeनाम`, `probeक्ष`) lost its header and its param_types; the unicode gauntlet's 8 Java cells failed against their ASCII twins. A non-ASCII name is now searched literally (gauntlet 950/950). - X5: the binary anomaly detector (xray) read the one-literal Rust `a as b` pattern as a dense string (Shannon entropy 4.9); it is built from a named identifier piece now. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
`tests/tools/crucible_check.py --update --yes` (both modes). The scan output moves because the call graph gained edges: receiver-typed links (X3), Java overloads chosen by argument type (J1), C++ arity ranges and `ctor` edges (P5, P3), Python property getters (Y2) and renamed imports (X5). Function fan-in / fan-out / PageRank, the confident call pairs that join the file graph (import_edges, blast radius, network macro, bottlenecks) and the SQLite snapshot (new function_data columns calls_out_arg_types, param_types, arity_range, ctor_forms, property_reads, calls_out_renames; class_data.method_arities) change accordingly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
Contributor
…#8161) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…rd requires (main red since #8188) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…an number (88.3, as on main; local pyan reads 88.9) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF
…loads # Conflicts: # tests/tools/test_evidence_refresh_artifact_names_8185.py
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.
Part of #8161. PR 4 of 4: typing and overloads. The engine now works out which object a method is called on and which overload is meant, for C++, Go, Rust, TS/JS, Java and Python.
What changes
x.m()links to the method ofx's class. The class comes from parameters, locals, constructions (new T,T{},T::new(),make_unique<T>) and fields. New resolver steptyped(core/receiver_types.py). The declaration and field scans stay linear, so the C++ linear-time test is unchanged.core/java_arg_types.py; columnscalls_out_arg_typesandparam_types, recorded, healed and rehydrated). Also fixed: Java method names with combining marks.function_data.arity_range,class_data.method_arities). An exact count wins, then a default, then a variadic.T x;,T x{..},T x = lit;,make_unique/make_shared<T>) become a newctoredge kind, reported separately (owner decision: kinds are labelled, never folded intocall).T x(a)now counts its arguments.@property/@cached_propertyread anywhere is a call to its getter.core/import_renames.py).Gates (confident precision / strict / recall; before = PR 3, #8186)
typedlinks are 98.7–100% precise.ctoredges are 95.2% precise (21 judged).Also run locally:
--ci, ruff;pr_gates --fast;import_graph_accuracy --ci(27 languages);The full unit run's only failures are environmental: no pandas or tree_sitter_language_pack in the local venv, and a stale local keyword-rosetta clone. CI has all three.
Follow-ups (not in this PR)
p.emit(1)still picks the wrong overload);.cppmethods;operatorandmacroedge kinds.export { _gte as gte }) need a per-file export map.🤖 Generated with Claude Code
https://claude.ai/code/session_018srRvhoWCV984xPpQKJHfF