Home

giogio / openez-graph

public
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(go): qualify method names with receiver type to prevent collisions

3 months ago

7f91ec8
Authored
asta-nguyen8/8/2026, 6:40:10 AM
Go methods were indexed as just the method name (e.g. "Save"),
so same-named methods on different types (Foo.Save, Bar.Save)
collided in the symbol graph. Call edges via receiver variables
(f.Save()) resolved to the last-inserted "Save" symbol — targeting
the wrong type.

Fix: qualify method symbol names as Type::Method (e.g. Foo::Save)
and qualify call callees through the receiver variable as
Type::method (e.g. f.Validate() → Foo::Validate).

This matches the existing regex parser behavior in languages.ts.

Changed in both parsers:
- packages/native/src/parser.rs (Rust tree-sitter):
  - Add go_receiver_name and go_receiver_type helpers
  - Qualify method name with receiver type
  - Track receiver (var, type) in context stack
  - Qualify calls through receiver variable
- packages/indexer/src/tree-sitter/parse.ts (TS tree-sitter):
  - Add goReceiverName and goReceiverType helpers
  - Qualify method name with receiver type
  - Pass receiver info to extractCallsInNode
  - Qualify calls through receiver variable
- tests/tree-sitter-parser.test.ts:
  - Update expected symbol name: Greet → Greeter::Greet

Typecheck 8/8, tests 144 pass.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Parent446ae79

3 files changed
  • packages/indexer/src/tree-sitter/parse.ts+62−8
  • packages/native/src/parser.rs+77−21
  • tests/tree-sitter-parser.test.ts+2−2