Skip to content

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

Closed

Description

@squid-protocol

What

Bug: a qualified call whose receiver is a field or a local of another type still resolves to the caller's own class when that class has a method of the same name. The class step wins over the receiver.

Example, members.entrySet() inside JsonObject:

  • members is a LinkedTreeMap, so the call runs LinkedTreeMap.entrySet;
  • the engine links JsonObject.entrySet instead.

Evidence

Measured vs scip-java 0.12.3 on google/gson @ 854c8255 (#3783). Of the 1,923 confident wrong links, 270 are not an overload choice (#3835's pattern). Their samples are this shape, all checked in source:

site engine links scip-java links
gson/.../JsonObject.java:55, in deepCopy: for (... : members.entrySet()) JsonObject.java:entrySet@136 LinkedTreeMap.java:entrySet@442
JsonObject.getAsJsonPrimitive, getAsJsonArray, getAsJsonObject: members.get(memberName) JsonObject.java:get@186 LinkedTreeMap.java:get@95
gson/src/test/.../JsonPrimitiveTest.java: value.toString() on a JsonPrimitive LazilyParsedNumber.java:toString@75 JsonElement.java:toString@421

It overlaps #3756, and also sends links out of the repo. The same tree gives 473 confident external links: calls that scip-java resolves only to the JDK, linked to a gson method instead. For example, collection.add("hello") on a java.util.Collection is linked to JsonArray.add, and labelToSubtype.entrySet() on a Map to JsonObject.entrySet. That is #3756's untyped-receiver shadowing, measured in Java.

Likely fix

The resolver must not take the class step for a call qualified by a receiver other than this or super. A qualified call should resolve through the receiver's type, where it is known, using the typed and receiver steps. When it isn't known, the link belongs in the ambiguous group, not a confident same-class link.

Check the net change on every language, since the resolver is shared: Python's self.x.m() and TypeScript's this.x.m() take the same path.

Epic #3772. Related: #3756.

Activity

  1. added
    bug
    core-engine
    on Sep 26, 2026
  2. added
    scope:infra
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginescope:infra

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions