Skip to content

Dot completion loses generic call binding in getFieldAccessType #3205

@midnattsol

Description

@midnattsol

Summary

Dot completion after generic calls can lose type information in the field-access resolver path.

While investigating a separate completion inconsistency, I noticed this generic-call path has incomplete binding in getFieldAccessType. I added focused repro tests and confirmed the behavior.

Repro

const S = struct { alpha: u32 };
fn make(comptime T: type) T { return undefined; }
const foo = make(S).<cursor>

Expected behavior

Completion should include:

  • alpha

Actual behavior

Completion may be empty or miss expected members after the generic call result.

Suspected root cause

In src/analysis.zig, getFieldAccessType(...) call handling in the l_paren branch does not reliably preserve generic call argument bindings in this path.

There is already a related TODO in that area about binding call params:

  • src/analysis.zig (around call handling in getFieldAccessType)

Scope

This appears to be a semantic/type-resolution issue in dot completion, not primarily the parser-recovery umbrella tracked by #2346.

Additional context

A possible approach is to prefer AST-based call resolution when available, while keeping the token-based path as fallback for incomplete/invalid code during editing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions