Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set attributes containing antiquotation in its name are ignored when there is a preceding definition #6293

Open
coord-e opened this issue Mar 21, 2022 · 0 comments

Comments

@coord-e
Copy link

coord-e commented Mar 21, 2022

Describe the bug

Attributes are unexpectedly ignored by Nix parser when there is a preceding definition of the set and the attribute name contains antiquotation.

Steps To Reproduce

minimal reproducible example:

# bug.nix
{
  set.name1 = {
    enable = true;
  };
  set = {
    "${"name2"}" = {
      enable = true;
    };
  };
}

parsing bug.nix only returns name1 as below:

$ nix-instantiate --parse bug.nix
{ set = { name1 = { enable = true; }; }; }

Expected behavior

parsing bug.nix expected to return both name1 and name2

nix-env --version output

$ nix-env --version
nix-env (Nix) 2.7.0

Additional context

this only happens when the attribute name contains antiquotation:

# parse: { set = { name1 = { enable = true; }; name2 = { enable = true; }; name3 = { enable = true; }; }; }
{
  set.name1 = {
    enable = true;
  };
  set = {
    # ok
    name2 = {
      enable = true;
    };
    # ok
    "name3" = {
      enable = true;
    };
    # ng
    "${"name4"}" = {
      enable = true;
    };
  };
}

this happens regardless of how the preceding set is defined:

# parse: { set = { name1 = { enable = true; }; }; }
{
  set = {
    name1 = {
      enable = true;
    };
  };
  set = {
    "${"name2"}" = {
      enable = true;
    };
  };
}
# parse: { set = { name1 = { enable = true; }; }; }
{
  set.name1.enable = true;
  set = {
    "${"name2"}" = {
      enable = true;
    };
  };
}
# parse: { set = { }; }
{
  set = {};
  set = {
    "${"name2"}" = {
      enable = true;
    };
  };
}
@coord-e coord-e added the bug label Mar 21, 2022
@stale stale bot added the stale label Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant