about summary refs log tree commit diff
path: root/tvix/eval/src/tests/tvix_tests (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-08-31 r/4561 feat(tvix/eval): implement scope poisoning for true/false/nullVincent Ambo4-0/+15
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>
2022-08-31 r/4560 refactor(tvix/eval): simplify `let ... in ...` before recursionVincent Ambo2-0/+8
While full recursion through thunking is not available, there are actually incorrect behaviours introduced by declaring before binding (example in the newly introduced test). This commit simplifies the implementation to avoid this issue, and also because I intend to explore a bit more how far we can get in non left-to-right bindings *without* introducing thunks immediately. Change-Id: I21fd3007ac3946570639772d7d624d70bd209958 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6226 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: grfn <grfn@gws.fyi>
2022-08-31 r/4559 test(tvix/eval): add basic tests for with expressionsVincent Ambo4-0/+11
Change-Id: I94664090e7a2b060dfbe21c1eeb859fb31e417b0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6225 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: grfn <grfn@gws.fyi>
2022-08-31 r/4549 feat(tvix/eval): implement inherit in let expressionsVincent Ambo2-0/+9
Note that at this point recursive bindings do not yet work in either attrsets or let, so inheriting from the same scope is generally not possible yet. Change-Id: I6ca820d04b8ded5c22fb7ea18e2ec203bcaa8e9c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6215 Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-08-31 r/4548 feat(tvix/eval): implement `inherit` in attribute set literalsVincent Ambo4-0/+6
Straightforward implementation, evaluating the elements of an inherit and preparing the stack so that `OpAttrs` sees all relevant values when constructing the attribute set itself. The emitted instructions for inheriting a lot of values from the same attribute set are inefficient, but it's too early to say whether this actually matters. Change-Id: Icb55a20936d4ef77173f34433811c5fa5d2c9ecc Reviewed-on: https://cl.tvl.fyi/c/depot/+/6214 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-08-30 r/4545 feat(tvix/eval): Implement inherit from outer scope in attrsVincent Ambo2-0/+5
Change-Id: I97fa45059b7f2cbe96eb60bd1821e3e25832df66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6212 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-08-30 r/4544 fix(tvix/eval): `?` operator should use OpAttrsOrNotFoundVincent Ambo2-0/+4
Using `OpAttrSelect`, the ? operator will fail when encountering a nested value that is not an attribute set. This however breaks valid code, such as: { bs = 42; } ? bs.a.b The fix is simply to use the same operator used in the `or` statement, which leaves a sentinal on the stack if a field is not found or the value is not an attribute set. Change-Id: Ib28fc8a96e6d592b4cdbc3e65ba129ad8faecd66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6211 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-08-30 r/4543 fix(tvix/eval): `or` should handle non-attrset values, tooVincent Ambo2-0/+3
If a nested attrpath encounters a non-set value, the sentinel value denoting a lack of next values should be emitted. This mirrors the behaviour of Nix. Change-Id: Ia80443d5a11243cc6d98dcab1249a3f5fdf77e27 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6210 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-08-30 r/4542 fix(tvix/eval): allow use of ? operator on non-set typesVincent Ambo2-0/+4
Nix allows this, but always returns false. Tvix needs to do the same. Change-Id: Ic9eec90834a0d0969eea5316d5c25032d3691d94 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6209 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-08-30 r/4541 fix(tvix/eval): emit correct count in OpAttrPathVincent Ambo2-0/+2
Not sure how exactly this snuck in, but it caused some subtle breakages in deeply nested attribute sets. Change-Id: I8049ce912405d3750031f79cc8d86ff1c3c02c2b Reviewed-on: https://cl.tvl.fyi/c/depot/+/6208 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-08-29 r/4527 test(tvix/eval): add basic tests for let expressionsVincent Ambo6-0/+17
Change-Id: I788504f0c1848a1422c99006bf659738df614716 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6191 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-08-26 r/4501 test(tvix/eval): add tests for the attrset `or` operatorVincent Ambo8-0/+8
Change-Id: I81f3ab94d8b987f5a4c87a27b2bcbb49cccee1ce Reviewed-on: https://cl.tvl.fyi/c/depot/+/6168 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-25 r/4479 feat(tvix/eval): implement list concatenationVincent Ambo2-0/+2
Change-Id: Icdf715d116371a9f139bdf95266410bf967bef25 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6144 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-08-25 r/4478 feat(tvix/eval): implement binary comparison operatorsVincent Ambo16-0/+72
This is accomplished by simply delegating to the Rust implementations of (Partial)Ord and (Partial)Eq, which are implemented for Value and underlying wrapper types to behave like they do in Nix. To ease the implementation overhead, a new comparison operator macro has been added to the VM module. Incomparable types will raise a new error variant when a comparison is attempted, containing both supplied types. This mimics the information carried in the error thrown by C++ Nix. Change-Id: Ia19634d69119d40722f3ca672387bc3a80096998 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6143 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-08-25 r/4476 feat(tvix): implement not-equals (!=) operatorVincent Ambo8-0/+8
Change-Id: Ic259d6d0cf30553e944682a0d1d2c610df7fe5c2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6141 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-08-25 r/4475 feat(tvix/eval): implement attrset update (`//`) operatorVincent Ambo8-0/+8
The underlying implementation does a few tricks based on which pair of attrset representations is encountered. Particularly the effect of short-circuiting the empty cases might be relevant in nixpkgs/NixOS, due to the use of lib.optionalAttrs. Change-Id: I22b978b1c69af12926489a71087c6a6219c012f3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6140 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-08-25 r/4472 feat(tvix/eval): implement string concatenationVincent Ambo4-0/+4
Change-Id: If61066e59232b2bad42b5cb5f0f2d9b9c416be8b Reviewed-on: https://cl.tvl.fyi/c/depot/+/6137 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-25 r/4470 test(tvix/eval): add some eval-okay-* tests for trivial typesVincent Ambo12-0/+26
Change-Id: I85ccc07e08c67abf4fcd3752c58e1702943239ac Reviewed-on: https://cl.tvl.fyi/c/depot/+/6135 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-24 r/4467 test(tvix/eval): add identity tests for literal evaluationVincent Ambo18-0/+36
Change-Id: Id3f37fbe341e15e9428ef1d579d61a514232c0e8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6132 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>