Skip to content

call resolver: an explicit receiver no longer defaults to the caller's own class (#3837) - #4134

Merged
squid-protocol merged 3 commits into
mainfrom
fix/3837-receiver-class
Oct 3, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fix/3837-receiver-class

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Fixes #3837

Root cause: this is not the class step. members.entrySet() inside JsonObject goes down the untyped-receiver path, and _visible_receiver returns file (confident) as soon as the caller's own file defines the name on exactly one class. That class is the caller's own, even though LinkedTreeMap (imported) also defines entrySet. explain_call confirms this: file (scoped) -> JsonObject.java:entrySet@136 qualifier 'members'.

Fix:

  • The resolver rule: when an explicit non-this receiver resolves file to the caller's own lineage class, and another visible file (an import, or the same package directory) also defines the name on a class, the call is an ambiguous receiver.
  • An entangled detector fix: Java () -> toJson(gson, x) recorded the qualifier <expr>, because -> was read as member access. Without this fix, the resolver change cost 13 correct links. -> is no longer a qualifier separator for Java. Kotlin, Groovy and Scala have the same problem, but are left out because nothing measures them yet.

Graph accuracy (run locally after merging main; same tools and pins as CI):

reference metric main this PR
Java, scip-java 0.12.3 (gson) confident precision (gated) 99.4% (5,000 judged) 99.7% (5,117 judged)
recall (gated) 63.3% 64.9%
resolution recall (gated) 64.9% 66.6%
strict precision (external counted wrong) 91.9% 92.8%
confident external 407 380
ambiguous precision (not gated) 26.1% 24.6%
Python, pyan3 2.8.1 confident precision (gated) 99.8% (1,806) 99.9% (1,805)
recall / resolution recall 51.7% / 97.7% unchanged
ambiguous precision (not gated) 66.7% 60.0%
TypeScript, tsc all gated metrics unchanged unchanged

Both resolution baselines are regenerated to lock in the improvement. The Python baseline also absorbs earlier drift from main (recall 51.6% → 51.7% was already on main).

Golden masters (both modes), audited before the re-bless:

  • Local runs reproduce main's committed goldens exactly (0 differences, full-precision and zero-dependency), so the comparison is trustworthy.
  • This PR moves 430 readings, all call-graph: PageRank 356, Fan Out 43, Fan In 31. Nothing outside the call graph changes.
  • Every edge change is a removed link: 74 fan readings, all down, net −88 links. They're only in object-oriented languages: Scala/Kafka 12, PHP/Laravel 12, Java/Spring Boot 9, JS/three.js 8, C#/Roslyn 7, Groovy/Gradle 8, Python/FastAPI 6, Zig 8, C++/Godot 2. Example: CSharpCompilation.Create fan-in goes from 12 to 8.
  • PageRank moves in other repos too (COBOL, Ada, …) because the crucible is scanned as one graph, so a removed edge re-normalises PageRank everywhere. The median relative change is 7%.
  • Re-blessed with tests/tools/update_golden_master.py in a full-precision venv and in a PyYAML-only venv; test_golden_crucible.py passes in both.

Tests:

  • test_call_resolver.py gains four Call resolver: an explicit receiver is ignored when the caller's own class has a method of that name #3837 tests:

    • an explicit receiver doesn't default to the caller's own class;
    • a same-package class counts as visible;
    • this. still resolves to the caller's own class;
    • with nothing else visible, the file step stays.

    The first two fail on main.

  • test_calls_out_qualifiers_3329.py gains a Java lambda arrow test (fails on main), plus a guard that -> stays a separator for PHP and C.

  • Suite and gates:

    • tests/core_engine + tests/extraction + call-graph tool tests + test_source_reads.py: 11,333 passed.
    • pr_gates.py --fast: lint, audits, secrets, X-Ray and gauntlet all pass.
    • ruff_audit --ci is clean.

Docs: the file and receiver rungs of docs/function_call_graph.md, the Java lambda note and the measurement-table row; the callgraph-miss-sweep skill row is marked fixed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ

…r's own class (#3837)

An untyped receiver whose only own-file candidate is the caller's own class is
ambiguous when another visible class defines the name. Java '->' (lambda arrow)
is no longer read as a member-access qualifier.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 2 commits October 2, 2026 23:39
…lines, golden re-bless, docs

- unit tests: an explicit non-this receiver is ambiguous when another visible
  class (import or package directory) defines the name; this/self and the
  nothing-else-visible case keep their answer; java '->' is a lambda arrow,
  not a qualifier separator (PHP/C keep it). The fix tests fail on main.
- java baseline vs scip-java 0.12.3 (gson): confident precision 99.4 -> 99.7,
  strict 91.9 -> 92.8, recall 63.3 -> 64.9, resolution recall 64.9 -> 66.6;
  python baseline vs pyan3 2.8.1: precision 99.8 -> 99.9, recall unchanged.
- golden masters (both modes): 430 readings move, all call-graph: PageRank 356,
  Fan Out 43, Fan In 31; every edge change is a removed link (74 readings,
  net -88), only in OO languages. Local main reproduces both goldens exactly.
- docs/function_call_graph.md ladder and measurement table; callgraph-miss-sweep
  skill row marked fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
@squid-protocol squid-protocol changed the title WIP: call resolver: an explicit receiver no longer defaults to the caller's own class (#3837) call resolver: an explicit receiver no longer defaults to the caller's own class (#3837) Oct 3, 2026
@squid-protocol
squid-protocol marked this pull request as ready for review October 3, 2026 08:08
@squid-protocol
squid-protocol merged commit a18c64e into main Oct 3, 2026
36 checks passed
@squid-protocol
squid-protocol deleted the fix/3837-receiver-class branch October 3, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Call resolver: an explicit receiver is ignored when the caller's own class has a method of that name

1 participant