Skip to content

Call nodes under //line directives get empty byte spans #21

Closed as not planned

Description

@sinha108

Describe the bug
Call nodes in a file with a //line directive get an empty byte span. Their positions come from the directive-adjusted line:col, while byte offsets index the real file, so slicing module.source returns an empty string.

To Reproduce

  1. A Go file containing //line virtual.y:900:1 followed by a function that makes calls.
  2. cango -i <dir> -a 1 -o /tmp/out
  3. Inspect those call nodes' span.bytes: start equals end (e.g. [433,433]).

Expected behavior
span.bytes covers the call's real text in the file, so source slicing recovers it. The line:col can stay directive-adjusted or be real, as long as the doc says which.

Logs
Observed in the testdata/dataflow/linedir fixture added by PR #16.

Additional context
Affects generated code: goyacc, ragel, templ, cgo output. Predates PR #16. The call callee resolution under //line is fixed in that PR; only the span is still wrong.

Activity

  1. sinha108 commented on Oct 25, 2026

    @sinha108
    ContributorAuthor

    Consolidated into #26, which carries this issue's full detail.

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