From afc6c1bad63e27d68adf49e673f8aafd36495a8a Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 15 Jul 2013 17:10:18 -0400 Subject: Simplify inherited attribute handling This reduces the difference between inherited and non-inherited attribute handling to the choice of which env to use (in recs and lets) by setting the AttrDef::e to a new ExprVar in the parser rather than carrying a separate AttrDef::v VarRef member. As an added bonus, this allows inherited attributes that inherit from a with to delay forcing evaluation of the with's attributes. Signed-off-by: Shea Levy --- tests/lang/eval-okay-delayed-with-inherit.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/lang/eval-okay-delayed-with-inherit.nix (limited to 'tests/lang/eval-okay-delayed-with-inherit.nix') diff --git a/tests/lang/eval-okay-delayed-with-inherit.nix b/tests/lang/eval-okay-delayed-with-inherit.nix new file mode 100644 index 000000000000..84b388c27130 --- /dev/null +++ b/tests/lang/eval-okay-delayed-with-inherit.nix @@ -0,0 +1,24 @@ +let + pkgs_ = with pkgs; { + a = derivation { + name = "a"; + system = builtins.currentSystem; + builder = "/bin/sh"; + args = [ "-c" "touch $out" ]; + inherit b; + }; + + inherit b; + }; + + packageOverrides = p: { + b = derivation { + name = "b-overridden"; + system = builtins.currentSystem; + builder = "/bin/sh"; + args = [ "-c" "touch $out" ]; + }; + }; + + pkgs = pkgs_ // (packageOverrides pkgs_); +in pkgs.a.b.name -- cgit 1.4.1