about summary refs log tree commit diff
path: root/tests/lang/eval-okay-redefine-builtin.nix
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2013-09-13T20·55-0400
committerShea Levy <shea@shealevy.com>2013-12-31T17·45+0000
commit136f2f7046dfed18fde0b5f9933ddfafc1518ef5 (patch)
tree203804716694587a810096af3d75ea3a41c9bbe1 /tests/lang/eval-okay-redefine-builtin.nix
parent5ba5993470a6ad532fc8e842084a574a88876b0a (diff)
Add the ExprBuiltin Expr type to the AST
Certain desugaring schemes may require the parser to use some builtin
function to do some of the work (e.g. currently `throw` is used to
lazily cause an error if a `<>`-style path is not in the search path)
Unfortunately, these names are not reserved keywords, so an expression
that uses such a syntactic sugar will not see the expected behavior
(see tests/lang/eval-okay-redefine-builtin.nix for an example).

This adds the ExprBuiltin AST type, which when evaluated uses the value
from the rootmost variable scope (which of course is initialized
internally and can't shadow any of the builtins).

Signed-off-by: Shea Levy <shea@shealevy.com>
Diffstat (limited to 'tests/lang/eval-okay-redefine-builtin.nix')
-rw-r--r--tests/lang/eval-okay-redefine-builtin.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-redefine-builtin.nix b/tests/lang/eval-okay-redefine-builtin.nix
new file mode 100644
index 000000000000..df9fc3f37d22
--- /dev/null
+++ b/tests/lang/eval-okay-redefine-builtin.nix
@@ -0,0 +1,3 @@
+let
+  throw = abort "Error!";
+in (builtins.tryEval <foobaz>).success