about summary refs log tree commit diff
path: root/tests/lang
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-05-15T13·46+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-05-15T13·46+0000
commita64bbe049e19618c33a878154f2e69029d45ecd7 (patch)
tree678788b5dc60db823e065d7ac1a33aba232b79d2 /tests/lang
parentd407d572fdc72f4eb14cc0f37d7d61446425b663 (diff)
* Change the scoping of "inherit (e) ..." in recs so that the
  attributes of the rec are in scope of `e'.  This is useful in
  expressions such as

    rec {
      lib = import ./lib;
      inherit (lib) concatStrings;
    }

  It does change the semantics of expressions such as

    let x = {y = 1;}; in rec { x = {y = 2;}; inherit (x) y; }.y

  This now returns 2 instead of 1.  However, no code in Nixpkgs or
  NixOS seems to rely on the old behaviour.

Diffstat (limited to 'tests/lang')
-rw-r--r--tests/lang/eval-okay-scope-7.exp1
-rw-r--r--tests/lang/eval-okay-scope-7.nix6
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-scope-7.exp b/tests/lang/eval-okay-scope-7.exp
new file mode 100644
index 000000000000..067d2b7461e8
--- /dev/null
+++ b/tests/lang/eval-okay-scope-7.exp
@@ -0,0 +1 @@
+Int(1)
diff --git a/tests/lang/eval-okay-scope-7.nix b/tests/lang/eval-okay-scope-7.nix
new file mode 100644
index 000000000000..4da02968f6b7
--- /dev/null
+++ b/tests/lang/eval-okay-scope-7.nix
@@ -0,0 +1,6 @@
+rec {
+  inherit (x) y;
+  x = {
+    y = 1;
+  };
+}.y