Skip to content

[Bug]: Python typed-receiver calls get no edge inside a nested function or a nested class's method #4226

Description

@rohit-jsfreaky

Pre-flight checks

  • I have checked the Troubleshooting section in the README

What happened?

The typed-receiver arm of _resolve_python_member_calls (#4198) checks that the receiver's class is defined in, or imported into, the caller's file. It finds the caller's file with _file_node, which returns the caller's first contains parent. For a top-level function or a method that parent is the file, but for a nested function it is the enclosing function, and for a method of a nested class it is the outer class. The check then compares a function (or class) id with the file's imports, fails, and the call gets no edge, although the extractor stamped the right receiver_type.

Nested typed callbacks are common, e.g. click's option factories:

# click/decorators.py
def confirmation_option(*param_decls, **kwargs):
    def callback(ctx: Context, param: Parameter, value: bool) -> None:
        if not value:
            ctx.abort()            # receiver_type: Context, but no edge to Context.abort

Measured against jedi on 0.9.80: click has 10 such calls (ctx.exit(), ctx.abort(), ...), rich 4; all 14 are real calls jedi resolves to the same method.

Steps to reproduce

mkdir -p demo/pkg && cd demo
touch pkg/__init__.py
printf 'class Client:\n    def send(self):\n        return 1\n' > pkg/client.py
cat > pkg/use.py <<'EOF'
from .client import Client

def top(c: Client):
    return c.send()

def outer():
    def inner(c: Client):
        return c.send()
    return inner
EOF
graphify update . --no-cluster
python -c "import json; g=json.load(open('graphify-out/graph.json')); n={x['id']:x['label'] for x in g['nodes']}; [print(n[e['source']], '->', n[e['target']]) for e in g.get('links', g.get('edges', [])) if e['relation']=='calls']"

Error output or graph output

top() -> .send()

`inner() -> .send()` is missing. Same for `class Outer: class Inner: def go(self, c: Client): c.send()`.

Graphify version

0.9.80 (6478eb7)

Operating System

Windows

Python Version

3.12

Installation Method

built from source (git clone)

Additional Environment Details

No LLM keys; AST only. Clean checkout of v8 @ 6478eb7 reproduces.

Additional context

Follow-up to #4198 (where this arm was added). PR right after this issue.

Activity

  1. github-actions commented on Oct 8, 2026

    @github-actions

    Thanks for opening this issue, @rohit-jsfreaky. 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. safishamsi commented on Oct 8, 2026

    @safishamsi
    Member

    Fixed by #4227 (thanks @rohit-jsfreaky), shipped in v0.9.81. Closing as resolved.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions