Skip to content

sibling let bindings extending one variable via dynamic attrpaths are rejected #33

Description

@wyattgill9

Two sibling let bindings that extend the same variable through dynamic attribute paths are rejected as a redefinition.

$ fix eval --expr 'let x="a"; y="b"; c.${x}=1; c.${y}=2; in c'
error: variable 'c' already defined at 1:29
  1 | let x="a"; y="b"; c.${x}=1; c.${y}=2; in c
    |                             ^ near `c`

$ nix-instantiate --eval -E 'let x="a"; y="b"; c.${x}=1; c.${y}=2; in c'
{ a = 1; b = 2; }

Only the both-dynamic case fails. Every static or mixed combination is accepted and correct:

$ fix eval --expr 'let x="a"; c.${x}=1; c.b=2; in c'
{ a = 1; b = 2; }

Hit by pkgs/by-name/lo/local-ai/tests.nix in the pinned nixpkgs.


fix 0.3.0 at 1f1a99cf, built -Doptimize=ReleaseSafe with Zig 0.16.0, darwin/aarch64. Reference implementation is Nix 2.34.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions