Skip to content

this.method() links an imported function of the same name instead of the class's own method #3034

Closed as duplicate

Description

@inth3shadows

What happens

Inside a class that has a method with the same name as an imported function (a common thin-wrapper pattern), this.find(...) links to the imported function, not to the class's own method.

// lib.ts
export function find(x: string): string { return x; }

// handler.ts
import { find } from './lib';

export class Handler {
  run(s: string): string {
    return this.find(s);      // should be Handler.find
  }

  private find(s: string): string {
    return find(s);           // the imported function, correctly
  }
}
  • Expected: Handler.run calls Handler::find.
  • Actual on main (60b0d7a): Handler.run calls lib.ts: find, with resolvedBy: import.

this. is an explicit receiver, so an import binding of the bare name should never satisfy it. codegraph's own source has 7 such sites; for example, ToolHandler calls this.findAllSymbols(...), which wraps the imported findAllSymbols, and this.groupDefinitions(...) is the same. Callers of the wrapper method are missing as a result, and the imported function shows callers it doesn't have.

Found by diffing codegraph's call edges against scip-typescript (the TypeScript compiler's references) on codegraph's own repo.

Activity

  1. inth3shadows commented on Oct 29, 2026

    @inth3shadows
    ContributorAuthor

    Duplicate of #2954, which I filed earlier for the same bug. The real cases found here are added there as a comment.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions