about summary refs log tree commit diff
path: root/tvix/eval/src/tests/tvix_tests
AgeCommit message (Collapse)AuthorFilesLines
2022-12-02 r/5369 test(tvix/eval): verify pointer equality checkssterni2-0/+47
Change-Id: I9baf2810fbd5b6ee8bfe10fce5b64801a35c1d67 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7369 Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2022-12-02 r/5368 test(tvix/eval): verify pointer equality in list comparisonssterni2-0/+7
Change-Id: I617d402c8ecc7aaf607c4bdcd58a06ebddb71fac Reviewed-on: https://cl.tvl.fyi/c/depot/+/7370 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com>
2022-11-26 r/5339 fix(tvix/eval): OpAdd must weakly stringify if either arg is stringAdam Joseph2-0/+8
Tests included. Change-Id: I7a4905d6103813373e383e2e8629c5fd243d6bca Reviewed-on: https://cl.tvl.fyi/c/depot/+/7377 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com>
2022-11-25 r/5310 test(tvix/eval): add eval-okay-closure-pointer-compareAdam Joseph2-0/+15
This test case checks two things: * A sanity check that "pointer equality for functions" means not just the lambda, but also the upvalues. * To be pointer-equal, it is not enough for the upvalues to be normal-form equal (i.e. `nix_eq()`-equal); the upvalues must be *pointer*-equal. The second part of the test case checks for this. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I4e59327a6f199b8212e97197b212e3c3934bb3f0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7372 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-11-24 r/5308 test(tvix/eval): test limits of builtins.seq's forcingsterni2-2/+2
Change-Id: I6dfc9108220762ef3372cd2739e91d79c01a55e1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7366 Tested-by: BuildkiteCI Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su>
2022-11-04 r/5242 test(tvix/eval): add a test case for groupBy with thunksAdam Joseph2-0/+7
We have to be careful implementing `builtins.groupBy`, since the list may contain thunks, and tvix's to_xxx() functions do not work on thunks. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I182b6fc2d4296f864ed16744ef70b153e8e6978a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7039 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-04 r/5241 fix(tvix/eval): quote keys which are not valid identifiersAdam Joseph2-0/+2
The impl Display for NixAttrs needs to wrap double quotes around any keys which are not valid Nix identifiers. This commit does that, and adds a test (which fails prior to this commit and passes after this commit). Change-Id: Ie31ce91e8637cb27073f23f115db81feefdc6424 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7084 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-31 r/5226 fix(tvix/eval): nix_eq() must recurseAdam Joseph2-0/+2
The current implementation of nix_eq will force one level of thunks and then switch to the (non-forcing) rust Eq::eq() method. This gives incorrect results for lists-of-thunks. This commit changes nix_eq() to be recursive. A regression test (which fails prior to this commit) is included. This fix also causes nix_tests/eval-okay-fromjson.nix to pass, so it is moved out of notyetpassing. Change-Id: I655fd7a5294208a7b39df8e2c3c12a8b9768292f Signed-off-by: Adam Joseph <adam@westernsemico.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7142 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-29 r/5223 test(tvix/eval): builtins.sort must preserve order of equal elementssterni2-0/+8
Change-Id: I59a0756940d1e5360a2ab4e886cf0bc9af7b8901 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7133 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-29 r/5221 feat(tvix/eval): Implement comparison for listsGriffin Smith2-0/+18
Lists are compared lexicographically in C++ nix as of [0], and our updated nix test suites depend on this. This implements comparison of list values in `Value::nix_cmp` using a very similar algorithm to what C++ does - similarly to there, this requires passing in the VM so we can force thunks in the list elements as we go. [0]: https://github.com/NixOS/nix/commit/09471d2680292af48b2788108de56a8da755d661# Change-Id: I5d8bb07f90647a1fec83f775243e21af856afbb1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7070 Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-10-28 r/5219 feat(tvix/eval): add builtins.replaceStringsJames Landrein2-0/+6
Change-Id: I93dcdaeb101364ee2273bcaeb19acb57cf6b9e7d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7034 Autosubmit: j4m3s <james.landrein@gmail.com> Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-25 r/5198 feat(tvix/eval): add builtins.{floor,ceil}James Landrein4-0/+4
Change-Id: I4e6c4f96f6f5097a5c637eb3dbbd7bb8b34b7d52 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7032 Autosubmit: j4m3s <james.landrein@gmail.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: grfn <grfn@gws.fyi>
2022-10-23 r/5185 test(tvix/eval): add a test case for nested sibling accessVincent Ambo2-0/+8
Change-Id: I3898284bc4871e5483ead0c27e0f2832d66f2b29 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7061 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-10-22 r/5176 test(tvix/eval): add a test for observing an infinite attribute setVincent Ambo2-0/+5
Note that this test (ironically) fails if the observer is used (e.g. with --trace-runtime), but that's a separate issue. Change-Id: I952eaeac8b5a7acce9c66cd4744ec570280748e7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7055 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-10-22 r/5175 feat(tvix/eval): Implement builtins.deepSeqGriffin Smith3-0/+3
This is done via a new `deepForce` function on Value. Since values can be cyclical (for example, see the test-case), we need to do some extra work to avoid RefCell borrow errors if we ever hit a graph cycle: While deep-forcing values, we keep a set of thunks that we have already seen and avoid doing any work on the same thunk twice. The set is encapsulated in a separate type to stop potentially invalid pointers from leaking out. Finally, since deep_force is conceptually similar to `VM::force_for_output` (but more suited to usage in eval since it doesn't clone the values) this removes the latter, replacing it with the former. Co-Authored-By: Vincent Ambo <tazjin@tvl.su> Change-Id: Iefddefcf09fae3b6a4d161a5873febcff54b9157 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7000 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-22 r/5174 fix(tvix/eval): use top-level span for `force_with_output`Vincent Ambo2-0/+2
When forcing thunks in `force_with_output`, the call stack of the VM is actually empty (as the calls are synthetic and no longer part of the evaluation of the top-level expression). This means that Tvix crashed when constructing error spans for the `fallible` macro, as the assumption of there being an enclosing span was violated. To work around this, we instead pass the span for the whole top-level expression to force_for_output and set this as the span for the enclosing error chain. Existing output logic will already avoid printing the entire expression as an error span. This fixes b/213. Change-Id: I93978e0deaf5bcb0f47a6fa95b3f5bebef5bad4c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7052 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-10-18 r/5156 fix(tvix/eval): wrap dynamic resolution in an extra thunkVincent Ambo3-1/+7
Without this change it was possible to cause situations (see the new test) in which a `with`-namespace was forced prematurely. Change-Id: I879ea7763b43edc693feace2c73c890d426fafd3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7031 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com>
2022-10-17 r/5155 feat(nix/eval): Implement builtins.functionArgsGriffin Smith2-0/+81
Now that we're tracking formals on Lambda this ends up being quite easy; we just pull them off of the Lambda for the argument closure and use them to construct the result attribute set. Change-Id: I811cb61ec34c6bef123a4043000b18c0e4ea0125 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7003 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-17 r/5154 feat(tvix/eval): Validate closed formalsGriffin Smith1-0/+1
Validate "closed formals" (formal parameters without an ellipsis) via a new ValidateClosedFormals op, which checks the arguments (in an attr set at the top of the stack) against the formal parameters on the Lambda in the current frame, and returns a new UnexpectedArgument error (including the span of the formals themselves!!) if any arguments aren't allowed Change-Id: Idcc47a59167a83be1832a6229f137d84e426c56c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7002 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-17 r/5152 feat(tvix/eval): Implement builtins.seqGriffin Smith3-0/+3
Since we already have infra for forcing arguments to builtins, this ends up being almost *too* simple - we just return the second argument! Change-Id: I070d3d0b551c4dcdac095f67b31e22e0de90cbd7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6999 Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-16 r/5148 feat(tvix/eval): implement builtins.partitionJames Landrein2-0/+14
Change-Id: I8b591f3057c68c1542046fc5a771973f2238c9df Reviewed-on: https://cl.tvl.fyi/c/depot/+/7020 Autosubmit: j4m3s <james.landrein@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-16 r/5141 fix(tvix/eval): don't coerce variable name to stringsterni1-0/+1
Change-Id: I8aa878dee009901feb453c489ce37c12fa3a31a8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7026 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-15 r/5137 feat(tvix/eval): Implement builtins.intersectAttrsGriffin Smith2-0/+4
Change-Id: Iaba9bcfa19f283cd0c1931be2f211e2528a1a940 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6998 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: kanepyork <rikingcoding@gmail.com>
2022-10-15 r/5136 feat(tvix/eval): Initial impl of builtins.matchGriffin Smith2-0/+30
Implement an *initial* version of builtins.match, using the rust `regex` crate for regular expressions. The rust regex crate definitely has different semantics than nix's regular expressions - but we'd like to see how far we can get before the incompatibility starts to matter. This consciously leaves out any sort of memo for compiled regular expressions (which upstream nix also has) for the sake of expediency - in the future we should implement that so we don't have to compile the same regular expression multiple times. Change-Id: I5b718635831ec83397940e417a9047c4342b6fa1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6989 Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-15 r/5135 feat(tvix/eval): Implement builtins.fromJSONGriffin Smith4-0/+28
Using `serde_json` for parsing JSON here, plus an `impl FromJSON for Value`. The latter is primarily to stay "dependency light" for now - likely going with an actual serde `Deserialize` impl in the future is going to be way better as it allows saving significantly on intermediary allocations. Change-Id: I152a0448ff7c87cf7ebaac927c38912b99de1c18 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6920 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-15 r/5133 fix(tvix/eval): bring foldl' strictness in line with C++ Nixsterni5-0/+9
Working on https://github.com/NixOS/nix/pull/7158, I discovered that C++ Nix actually is strict in the accumulator, just not in the first value. This seems due to the fact that in the C++ evaluator, function calls don't seem to be thunked unconditionally and foldl' just elects not to wrap it in a thunk (don't quote me on this summary, even though it seems to line up with the code for primop_foldlStrict and testable behavior). It doesn't seem worth it to risk breaking the odd Nix expression just to be strict in one more value per invocation of foldl' (i.e. the initial accumulator value `nul`), so let's match the existing C++ Nix behavior here. Change-Id: If59e62271a90d97cb440f0ca72a58ec7840d1690 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7022 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-15 r/5132 feat(tvix/eval): implement builtins.dirOfAdam Joseph2-0/+11
This commit causes the test eval-okay-builtins.nix to pass. It also adds tests/tvix_tests/eval-okay-dirof.nix which has better coverage than the nix tests for this builtin. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I71d96b48680696fd6e4fea3a9861742b35cfaa66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6987 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-13 r/5125 feat(tvix/eval): implement builtins.baseNameOfAdam Joseph2-0/+11
This commit implements builtins.baseNameOf and adds a test case eval-okay-basenameof.nix to the test suite. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: Ib8bbafba2ac9ca0e1d3dc5e844167f94890d9fee Reviewed-on: https://cl.tvl.fyi/c/depot/+/6997 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-10-13 r/5124 fix(tvix/eval): parseDrvName should not coerce, and xfail testAdam Joseph1-0/+1
builtins.parseDrvName should not coerce its argument to a string. This commit fixes that oversight in my previous commit, and adds an xfail test to cover this condition. Thanks to @sterni for noticing this. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I76bc78f1a82e1e08fe5c787c563a221d55de2639 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6991 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-10-12 r/5115 test(tvix/eval): add eval-okay-parsedrvname.{exp,nix}Adam Joseph2-0/+13
Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I59254a0ac513b3d2a6b2184554358bb6eba2ba99 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6949 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-11 r/5105 fix(tvix/eval/builtins): force acc not list element in foldl'sterni2-0/+9
When investigating discrepancies between foldl' in tvix and C++ Nix, I discovered that C++ Nix's foldl' doesn't seem to be strict at all. Since this seemed wrong, I looked into Haskell's foldl' implementation which doesn't force the list elements (`val` in our code), but the accumulation value (`res` in our code). You can look at the code here: https://hackage.haskell.org/package/base-4.17.0.0/docs/src/GHC.List.html#foldl%27 This actually makes a lot of sense: If `res` is not forced after each application of `op`, we'll end up thunks nested as deeply as the list is long, potentially taking up a lot of space. This can be limited by forcing the `res` thunk before applying `op` again (and creating a new thunk). I've also PR-ed an equivalent change for C++ Nix at https://github.com/NixOS/nix/pull/7158. Since this is not merged nor backported to our Nix 2.3 fork, I've not copied the eval fail test yet, since it wouldn't when checking our tests against C++ Nix in depot. Change-Id: I34edf6fc3031fc1485c3e714f2280b4fba8f004b Reviewed-on: https://cl.tvl.fyi/c/depot/+/6947 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-10-11 r/5102 feat(tvix/eval): Implement builtins.removeAttrsGriffin Smith3-0/+11
Change-Id: I28910991a0108436a42ac7bf3458f9180a44154e Reviewed-on: https://cl.tvl.fyi/c/depot/+/6928 Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-11 r/5100 fix(tvix/eval): Pop frames even if running op failsGriffin Smith2-1/+2
Previously, the VM assumed that if an error was returned from `run()`, the evaluation was "finished" and the state of the VM didn't matter. This used to be a reasonable assumption, but now that we've got `tryEval` around we need to actually make sure that we clean up after ourselves if we're about to return an error. Specifically, if the *last* instruction in an evaluation frame returns an error, we previously wouldn't pop that evaluation frame, which could cause all sorts of bizarre errors based on what happened to be in the stack at the time. This commit splits out a `run_op` method from `VM::run`, and uses that to check the evaluation frame return condition even if the op we're running is about to return an error, and pop the evaluation frame if we're at the last instruction. Change-Id: Ib40649d8915ee1571153cb71e3d76492542fc3d7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6940 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-10 r/5095 feat(tvix/eval): Implement builtins.readFileGriffin Smith2-0/+2
Change-Id: If3fd0b087009a2bfbad8bb7aca0aa20de906eb12 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6921 Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: kanepyork <rikingcoding@gmail.com> Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-10 r/5091 fix(tvix/eval): path resolution errors are catchableGriffin Smith2-1/+2
Despite this not being documented, `tryEval` is empirically able to catch errors caused by a <...> path not resolving (and nixpkgs depends on this). Change-Id: Ia3b78a2d9d2d0c603aba829518b351102dc55396 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6926 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-10-10 r/5090 fix(tvix/eval): Thunk `if` exprGriffin Smith2-0/+7
Since the body of an `if` expr can refer to deferred upvalues, it needs to be thunked so when we actually compile those deferred upvalues we have something for the finalize op to point at. Without this all sorts of weird things can happen due to the finalize op being run in the wrong lambda context, up to and including a panic. Change-Id: I040d5e1a7232fd841cfa4953539898fa49cbbb83 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6929 Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-10-10 r/5089 feat(tvix/eval): Implement builtins.tryEvalGriffin Smith2-0/+6
With asserts compiled using conditional jumps, this ends up being quite straightforward - the only real tricky bit is that we have to know whether an error can or can't be handled. Change-Id: I75617da73b7a9c5cdd888c0e26ae81d2c5c0d714 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6924 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-10-10 r/5088 feat(tvix/eval): Implement builtins.pathExistsGriffin Smith2-0/+3
Change-Id: Ife8a690e9036868964771893ab29a9ae3a2d2365 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6919 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-10 r/5085 feat(tvix/eval): Allow adding strings to pathsGriffin Smith2-0/+10
Implement adding paths and strings via OpAdd. Since the nix rules are quite obscure, I'm electing to test this one with an oracle test to avoid the danger of getting the actual asserted result wrong. Change-Id: Icdcca3690ca2e8459e386c1f29cc48eaaa39e9a3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6914 Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-10 r/5084 feat(tvix/eval): Implement builtins.concatStringsSepGriffin Smith2-0/+9
Change-Id: I6e46bcdbf3b5258b60edb017709fee577eb8ec74 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6907 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-10 r/5083 feat(tvix/eval): Support builtins.readDirWilliam Carroll4-0/+2
Co-authored-by: Griffin Smith <root@gws.fyi> Change-Id: I5ff19efbe87d8f571f22ab0480500505afa624c5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6552 Autosubmit: wpcarro <wpcarro@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-10 r/5080 feat(tvix/eval): Implement builtins.elemGriffin Smith3-0/+68
Change-Id: Id99c1d33f87ad9866990d3483d3531e9e48f861f Reviewed-on: https://cl.tvl.fyi/c/depot/+/6916 Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-10 r/5076 feat(tvix/eval): Implement builtins.foldl'Griffin Smith2-0/+6
Change-Id: Ibc97db4343cb3a1a1677f69fb6c3518c61978aad Reviewed-on: https://cl.tvl.fyi/c/depot/+/6906 Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-10 r/5075 feat(tvix/eval): Implement builtins.genListGriffin Smith2-0/+2
Change-Id: Iabe28656229f508226b244d81382e517961eb3cf Reviewed-on: https://cl.tvl.fyi/c/depot/+/6901 Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-10 r/5074 feat(tvix/eval): Implement builtins.concatMapGriffin Smith2-0/+2
Change-Id: I08bfd040a242aa43b64760c19f48a28303f206ac Reviewed-on: https://cl.tvl.fyi/c/depot/+/6900 Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-09 r/5073 feat(tvix/eval): Implement builtins.listToAttrsGriffin Smith2-0/+16
Implement the listToAttrs builtin, which constructs an attribute set from a list of attribute sets with keys name and value. This is tested using an adaptation of the nix `eval-ok-listtoattrs.nix`, with the utilities from `lib.nix` inlined. Change-Id: Ib5bf743466dda9722c2c1e00797df4b58448cf0f Reviewed-on: https://cl.tvl.fyi/c/depot/+/6894 Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-08 r/5069 fix(tvix/eval): end scope after compiling legacy let bindingsVincent Ambo2-0/+2
When contrasting the compilation of the desugared version to the "sugared" version, this was the noticeable difference. This fixes b/203. Change-Id: Iae02ffc56e06de1de091b84cdc59d8fe83a17d69 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6898 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-08 r/5068 feat(tvix/tests): Import default.nix inside directoryGriffin Smith3-0/+6
This requires actually passing the source directory into `interpret` in the eval tests, but otherwise this is fairly straightforward - if we're trying to import a directory, just push `default.nix` onto it and import that instead. Change-Id: I0b7d4234f81977e78d14dfa651bf0cf9721017e5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6893 Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-10-08 r/5066 fix(tvix/eval): Force thunks when comparing against ground valsGriffin Smith2-1/+5
Thunks correctly force when comparing for equality against other thunks, but weren't being forced correctly when comparing against non-thunk values, in either direction. Change-Id: Ia03702895ec4d70aed3445c1b0a9a7a641d1a300 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6897 Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-05 r/5038 feat(tvix/eval): implement tvix's user-agent, err, nixVersionVincent Ambo2-0/+6
nixpkgs has hardcoded references to Nix versions, we need to provide it with something that looks like a Nix version while actually being a Tvix version. For now, we do this by stealing a trick out of the browser book and constructing a version that looks like a Nix version to Nix, but like a Tvix version to people who know what they are looking for. Nevermind that we don't actually have any kind of versioning for Tvix (yet?), other than depot revisions. Change-Id: I7ce8079dd8164a2079891d38e707f09a45f0bbc1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6858 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI