Skip to content

Go selectors on locals that shadow import aliases bind to the wrong package #5409

Done

Description

@sdivyanshu90

A Go call to a local receiver can be recorded as an EXTRACTED call into an unrelated imported package when the receiver shadows the import name.

Reproduction

On Graphify 0.9.115 with Python 3.14, create a Go module named example.com/m. Give store/store.go the package name store and functions Init and Save. In app/app.go write:

package app

import "example.com/m/store"

type Fake struct{}
func (Fake) Save() {}

func Run() {
    store.Init()
    store := Fake{}
    store.Save()
}

Run graphify extract . --code-only on the fresh corpus. The graph links both calls to the imported package. The second call should target Fake.Save.

The Go selector walker tests for the import name before looking at lexical bindings. Check the visible binding first and pass locally bound selectors to the receiver-type resolver. Add tests for calls before the declaration, inside and outside nested scopes, and through a shadowing parameter.

Activity

  1. github-actions commented on Nov 23, 2026

    @github-actions

    Thanks for opening this issue, @sdivyanshu90. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. added a commit that references this issue on Nov 24, 2026
    080d12e
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions