about summary refs log tree commit diff
path: root/tests/lang
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2013-07-15T21·10-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-08-26T09·31+0200
commitafc6c1bad63e27d68adf49e673f8aafd36495a8a (patch)
tree9cfe21245d123b5d7e525aa2722b1e155d29e736 /tests/lang
parent6cd6ce56083d0077485896a761520812d039bf10 (diff)
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 <shea@shealevy.com>
Diffstat (limited to 'tests/lang')
-rw-r--r--tests/lang/eval-okay-delayed-with-inherit.exp1
-rw-r--r--tests/lang/eval-okay-delayed-with-inherit.nix24
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-delayed-with-inherit.exp b/tests/lang/eval-okay-delayed-with-inherit.exp
new file mode 100644
index 000000000000..eaacb55c1aff
--- /dev/null
+++ b/tests/lang/eval-okay-delayed-with-inherit.exp
@@ -0,0 +1 @@
+"b-overridden"
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