feat(tvix/eval): implement scope poisoning for true/false/null

These tokens are optionally parsed as identifiers by Nix, which means
that within any scopes that resolve them the compiler needs to track
whether they have been overridden to know whether to emit the literal
instructions or resolve a variable.

This is implemented by a new concept of "scope poisoning", where the
compiler's scope structure tracks whether or not any builtin
identifiers have been overridden.

Change-Id: I3ab711146e229f843f6e1f0343385382ee0aecb6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6227
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-08-16 15:11:06 +03:00 committed by tazjin
parent 0b51d63081
commit 0f739cd944
5 changed files with 60 additions and 5 deletions

View file

@ -0,0 +1 @@
[ 1 2 3 ]

View file

@ -0,0 +1,6 @@
let
true = 1;
false = 2;
null = 3;
in
[ true false null ]

View file

@ -0,0 +1 @@
[ true false null 1 2 3 ]

View file

@ -0,0 +1,7 @@
let
poisoned = let
true = 1;
false = 2;
null = 3;
in [ true false null ];
in [ true false null ] ++ poisoned