Skip to content

L2 does not resolve call sites inside closures #17

Closed

Description

@sinha108

Describe the bug
L2 never resolves call sites inside closures (function literals). CallGraphBuilder.Build (internal/semantic_analysis/call_graph.go) walks top-level functions and methods only, not InnerCallables, so every call node inside a closure keeps callee: null and produces no call_graph edge. On testdata/chi, all 245 closure call nodes are unresolved. This predates the L3 branch (main behaves the same).

To Reproduce

  1. cango -i testdata/chi -a 2 -o /tmp/out
  2. Find any callable under another callable's callables{} (a closure_N) and inspect its body call nodes.
  3. Every callee is null, and no call_graph edge has a closure as src.

Expected behavior
Call sites inside closures resolve like any other call site: callee is the callee's id (in-project or @external), and call_graph has an edge from the closure's callable id.

Logs
Not applicable: the output is valid; the facts are missing.

Additional context

  • Fix needs closures to carry their declaring file (Path) so the dedup key (Path, Signature, callee) and emission's (Signature, SourcePath) resolution keep working.
  • Matters before L4: interprocedural edges out of closures (handlers, callbacks, goroutines) depend on it.
  • Found by the whole-branch review of PR Go L3 intraprocedural dataflow, app-outermost ids and L2 library calls #16.
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