Commit Graph
100 Commits
Author SHA1 Message Date
piegamesandeldritch horrors 567348a90c testlib: default nix fixture to also test all daemon protocols (2/3)
This commit enables the parametrization for "legacy-combined" protocol.
All failing tests with that have been either fixed or disabled. Notably:

- A couple of tests (e.g. involving builders) could be made to work with
a non-local store, but this would require some refactoring to testlib in
order to make certain configuration settings generic over local and
remote operations. We've disabled those for now, in order to make
progress
- The store tests all run locally only because of their nature
- The flakes tests also all run locally only because my energy for
fixing them is limited (and it's a *lot* of test failures, with probably
little overall benefit in terms of test coverage)

Change-Id: I56fa249a64f7c17c952f688ec89e9687f2a13f12
2026-06-28 18:17:57 +02:00
piegamesandeldritch horrors 9e846fbaea testlib: Small feature additions
Change-Id: I8940e66a1fb89cf8024b1e94e328b28a008a1452
2026-06-28 13:45:48 +02:00
piegames 7cdda9c5fa flakes: checkOverlay: Don't check the second argument
It's software archaeology time.

- In 2019 (Nix 2.4), Eelco added `checkOverlays`, which strictly checked
that the overlay must be a function of two arguments, one called `final`
and the other `prev`. (dc3f52a144,
gh#3573)
- In 2024, NofairKing opened an issue about checking the exact name
being a silly idea (gh#10516). Instead of trying to make the check more
sensible, the first fix attempt simply expanded the check to allow
`previous` instead of `prev` (the author's preferred name for the
attribute, supposedly; gh#10553). After some discussion, instead a PR
got merged which simply removed the `prev` check altogether, while
leaving the `final` argument check intact for some reason
(ad65a50a94a97bf1f1a1902f43542d28a2e8206b, gh#10572).
- In 2025, over at Lix and oblivious to the latest change over at
CppNix, I came across this stupid check while trying to improve the
abstractions of the AST in Nixexpr. I spent (wasted, retrospect)
considerable amounts of time removing the exact name checks while also
improving the check overall (making it check for more than two
arguments, and also generally improved error message).
(0928d4d87a,
Id4244171123dd8a228be71ce9f04d8e9f647c111)
- Fast forward to 2026, where I run into this becursed piece of code
once again, and once again during some Lixexpr cleanups. Now that I have
seen how carlessly the issue was handled at CppNix, I can't be arsed to
give a flying fuck anymore. Out the code goes. Bye.

With this commit, all casts on `Expr` subclasses outside of libexpr
itself have been removed. No more violation of abstraction boundaries.
Good riddance.

Change-Id: I939968bb01d461764cfa0f4ea7152b4fcf1acf93
2026-05-06 17:22:19 +02:00
piegames 481fc30ae7 libexpr/flakes: Replace the AST checks with maxCallDepth = 0
Change-Id: I7130cc941b4b7432df76a3995d298edfb28e6a01
2026-05-06 17:22:19 +02:00
piegames 078bbe6171 libexpr/eval: Fix off by one in maxCallDepth calculation
This isn't really relevant for a setting of 10k, but now that we want to
set it to 0 for Flakes it makes a difference as to whether or not one
top-level function call is allowed or not. (It shouldn't be)

Change-Id: I6bbf99826af0289c232b9d45d172a378b81abe4b
2026-05-03 13:05:46 +02:00
piegames 076d1aa4cd eval: switch up ExprOpConcatLists error position again
This is a minor adjustment to 2b22dae1ba /
I3e9d7c1c7a6599a8e68302448bbb961d051002b7

Basically having the error point to the operand instead of the operator
kind of makes sense, but it would require error spans to *truly* make
sense, and in the meantime maintaining the logic is more hassle than it
is worth.

Change-Id: Idac98dd77a0f4a6cb386cb74e0d4eb5fd2f503e5
2026-04-30 17:14:43 +02:00
piegamesandeldritch horrors 8782c7533f eval: Improve ExprConcatStrings error messages and positions
"while evaluating a path segment" was just plain wrong

Co-authored-by: eldritch horrors <pennae@lix.systems>
Change-Id: I827374635df2887d17a8ee8b1755c078bf0b506b
2026-04-30 17:14:43 +02:00
piegames 5afda956a7 tests/functional2/lang: Some refactorings
I did a pass through all files, fixing bits that have annoyed me here
and there based on vibes. Roughly:

- Replaced some out values like bools or strings with lists where
appropriate. Those tests were likely older than the value printer
- Added some parser tests where it makes sense
- Gently touched some formatting woes, while trying to not cause too
much diff noise
- Removed some dead `with (import ./lib.nix);` code

Change-Id: I8c40b2110f0b7799f68ae38ba61f049c5f1f6ee8
2026-04-19 16:07:54 +02:00
piegames c1f75860d6 builtins.flakeRefToString: Force the arguments
Without this, the primop chokes on any thunks on attributes passed in
the attrset. It even is the reason why the test contained `builtins.seq`
to work around this. Supposedly, this might have been an intentional
restriction and changing this might break things in ways I cannot forsee
due to not knowing much about Flakes, however the status quo is equally
broken:

- The error message looks like an internal error and not like some
explicitly forbidden invariant violation.
- Seemingly simple syntax literals like "-1" compile to "__sub 0 1" and
thus create a thunk which then fails, which is utterly confusing ("why
does 1 work but not -1?")
- This is a stark violation of the principle of least surprise.
- Thunking relies on maybeThunk and thunk inlining optimizations, thus
not forcing thunks turns operational details of the evaluator into
language-observable behavior. That's bad.

I am changing this now regardless of the risk of breakage, because the
bytecode evaluator will have different thunk inlining optimizations and
thus inevitably cause mismatches in behavior anyways.

Change-Id: Ifc45c4d2900e40822383670b28e4e50ab8af317a
2026-04-16 15:53:38 +02:00
piegames 35b776540f libutil/LinearMap: Expose rbegin and rend functions
Change-Id: I9a4350cc147c98c785b26fbef6c235cd5c48a4cc
2026-03-23 14:47:39 +01:00
piegames d04fcb57fd libexpr: Don't call setName on dynamic attrs
And also document in great detail why this is a wrong thing to do

Change-Id: Ifd1331ee7ee4e05322593ada801bab1c3ea8d349
2026-03-23 14:47:39 +01:00
piegames 93edf577b7 libexpr/eval: Factor out attrs updating code into dedicated helper function
The bytecode evaluator can use it 1:1

Change-Id: I9791a749231fe42e0e534853d3f3cce91913346c
2026-03-23 14:47:39 +01:00
piegames 35b46d1fcb libexpr/value: Add constants for the empty set and null
Change-Id: I4b673cbb81b06f1c415a0059cf1238d2d329725e
2026-03-16 22:21:35 +01:00
piegames 3c0fcf6836 libutil/chunked-vector: Add default constructor
Change-Id: I75a2d0daac7ddddbe4bb3791f642e15cfbe5f732
2026-03-16 22:21:35 +01:00
piegames ef2fd27467 deprecated-features/rec-set-dynamic-attrs: Downgrade to warning for now
Looks like too much stuff is breaking on this, so let's make it only a
warning for now to ease transition

Change-Id: I52d50ceb1fe1fbe9f4e28d0aabf3537f7e4d52d1
2026-02-11 12:24:35 +01:00
piegames ae4a000576 deprecated-features/broken-string-escape: Improve warning message
Explicitly catch common errors (trying to escape line breaks, badly
escaping interpolations) to provide better messages and user guidance
for these cases.

Change-Id: I3dd1b2ad3bca33be393e65be5e72f4fb9544a46a
2026-02-11 12:24:35 +01:00
piegames 16bd27fb78 deprecated-features/rec-set-overrides: Upgrade to hard error
Change-Id: Ifec24ee905e821058a7259be00460bf2988429d8
2026-01-31 21:58:33 +01:00
piegames c76632e17d deprecated-features/ancient-let: Upgrade to hard error
Change-Id: Ib856a665a8175a880b3ff52dde9d34769f24713b
2026-01-31 21:58:33 +01:00
piegames adfbc836c0 libexpr: Expand shadow-internal-symbols deprecated features to code null, true and false
Change-Id: If20efb9afced8665ba5c3b45cd09542e398867aa
2026-01-31 21:58:33 +01:00
piegamesandCommentator2.0 7e68f93ed7 libexpr: Require whitespace between certain tokens
Fixes #135, #136

Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems>
Change-Id: Ia1880633c1ee3b9242487fbc30b6d781d88987fb
2026-01-31 20:44:34 +01:00
piegamesandCommentator2.0 17f1bcfd2c libexpr: Deprecate or in non-keyword positions
Test cases courtesy of rhenrdic

Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems>
Change-Id: Id8df684ddd00d07b49e1c9e68bf41ee6c0e6887c
2026-01-31 15:32:28 +01:00
piegamesandCommentator2.0 af166146ff nix::parser::State::addAttr: Forbid dynamic attrs in recursive attrsets
Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems>
Change-Id: I92656b3b27f551bf286abc0d680c4a1c542337d7
2026-01-31 15:32:27 +01:00
piegamesandCommentator2.0 51dcc6ac0d nix::parser::State::addAttr: Forbid mixed-rec merges
Fixes #350, https://github.com/NixOS/nix/issues/9020

Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems>
Change-Id: If78d144dc35839b7668c0e0ad796252fcfc42ea0
2026-01-31 15:32:27 +01:00
piegamesandCommentator2.0 cbaa172775 libexpr: Warn on floating point literals without leading or trailing zero
Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems>
Change-Id: I0b58531ad091b22dc59d5717f5d1c8c814b4d2ea
2026-01-31 15:32:27 +01:00
piegamesandCommentator2.0 56dee9186f libexpr: Warn on incorrect string escapes
In Nixpkgs, there are several strings like "\d\.\d" which attempt to be
a regex but are just literally "d.d". The escaping rules are silly and
we should warn our users about that.

Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems>
Change-Id: I779b0757358fc9adc34dc140e1670b83abc93b67
2026-01-31 15:32:27 +01:00
piegamesandCommentator2.0 f1fbd1d095 libexpr: Warn on incorrect string usage
The indentation stripping semantics of strings are fairly bad and have a
few gotchas where they behave unintuitively. But the good news is, that
these cases are easy to catch and can be avoided.
This commit adds a warning in the parser when such strings are detected.

Unfortunately Nixpkgs uses this kind of a lot, so we won't be able to
actually enable this warning for a while to come.

Co-authored-by: Commentator2.0 <lix@crystal-cavern.systems>
Change-Id: I3b3b68c2eee4cd70959d3f4ca643cb6caf3a2217
2026-01-31 15:32:27 +01:00
piegames 4e1c216fd3 libexpr: Fix rec-set-overrides detection
Unfortunately, the previous code only detected superficial __overrides
and did not catch cases like `rec { __overrides.foo = 2; }`.

Change-Id: Ic38bdef1a6a3bdea91915aef44447f4ecc238259
2026-01-31 15:32:27 +01:00
piegames 9ad0ace8c0 deprecated-features: Rewrite feature descriptions
Changed the writing style of the descriptions, expanded with more
examples and rationale, and added the new timline metadata in the
frontmatter.

Change-Id: I218389e3504fc21f4eb45a927e77a41a1a70d4f5
2026-01-31 15:32:27 +01:00
piegames f289462c59 eval: Don't expose partially constructed sets
This turns several instances of unsoundness into runtime infinite
recursion errors

Fixes https://github.com/NixOS/nix/issues/7012,
https://github.com/NixOS/nix/issues/3241

Change-Id: Id8d352c5a78ef08d8913f07fe83f55c875684714
2026-01-31 15:32:27 +01:00
piegames 9588b1ad1b libexpr/eval: Split out expression evaluation
In an attempt to slowly split up and clean up `eval.cc`

The `Expr::eval` functions contain the most important logic when needing
to touch something on the evaluator, and having them spread across the
3kloc eval.cc file was really annoying. This should help, though more
cleanups are yet to come

Change-Id: I2c2d15a024ab1ec3fc5591f628d6768341a1c8ab
2026-01-05 23:54:34 +01:00
piegames ee608784dd libexpr/eval: Refactor force* and eval*, introduce check*
Status quo: We have `force$Type` and `eval$Type`, both which first
produce a value and then do a type check. The type checking logic is not
consistently implemented, with lots of code duplication.
This change does:

- Introduce new `check*` functions which unify the logic (the error
handling unfortunately still needs some duplication for now)
- Make both `force*` and `eval*` use the `check*` function for the
actual type checking
- Inline and dismantle the `eval*` functions for being of little use and
little used. This makes the `ExprOp*::eval` implementations for binary
logic operators more verbose, but IMO that's a good thing: The
implementation now needs to be a lot more explicit about the
short-circuiting semantics, something which was previously hidden behind
the short-circuiting semantics of the C++ language, in a way that could
easily be overlooked and lead to confusion, which is something that
happened to me twice in a year.
- Changes `forceAttrs` and `forceList` to include the context in case
`forceValue` fails (compared to only when the type check fails). This
was done for code consistency, because I could not find any reason why
list and attrs had different semantics here than int, float and bool. So
far the visible change is minimal (see the diff on the err.exp), however
this needs vetting for potential performance regressions.

Change-Id: I33e5c706d46850c9e1126293ee01dab85ba07587
2026-01-03 22:37:20 +01:00
piegames d387c9113c libexpr: Replace StaticSymbols with NixSymbolTable
That struct has been annoying me since I've encountered it. There is no
reason for having to track all these symbols out of band in the state.

Change-Id: I5c2c0d8174af0a51f9b456cc3651d8203a406d09
2026-01-03 13:19:55 +01:00
piegames eac96ef6b5 libexpr/NixSymbolTable: Init
The names were prefixed with `sym_` to allow faithfully representing
names that start with __. (Previously the underscores were omitted, at
the cost of readability for people less familiar with the intricate
details of Nix. Is `toString` literally `toString` or is it
`__toString`? etc.) As a bonus, this allows to easily grep for any
symbol through the entire code base to find where it is used. I've done
exactly that and grouped and annotated the symbols based on their usage.

Change-Id: I230fecd9b0b18e0984ac8111c1e6381f45c5abf2
2026-01-03 13:19:55 +01:00
piegames 3917e6b63a clang-format: Raise column limit to 110
100 causes too much diff churn w.r.t. current code style

"120 cols would be nuisance for us because our two-column layout is
exactly 118 wide (not counting the line number margin)"
"Ours is exactly 118 too"

Change-Id: Ifc7f21003e1011a17a1d799afaee775aeb927fd5
2026-01-02 17:51:33 +00:00
piegames 406fde33eb clang-format: Don't compact ifs and loops onto a single line
Change-Id: I422c7ee2b9865f9354f327cd2f151a7ff6c612b1
2026-01-02 17:51:33 +00:00
piegames 9ab386880d clang-format: Reduce alignment
Change-Id: I8326dba369707bc2d736c7e44d256d037dad9614
2026-01-02 17:51:33 +00:00
piegames 27a94369a9 nix::parser::State::addAttr: Deep attribute merging
Closes #845

Change-Id: Ie14d0e5a7a9fb778325c4ad30d1e1bd73c60b4f9
2025-11-24 19:16:27 +00:00
piegames 8765266dae nix::parser::State::addAttr: Improve error message
For some reason that eludes me, it used to only print the last attribute
instead of the full chain.

Change-Id: I2f5f6e85e2b1ab3ab20a9c99bf06d1e45a4d09bb
2025-11-24 19:16:27 +00:00
piegames 5484351523 nix::parser::State::addAttr: Sanitize
`e`, `ae`, `j`, `jAttrs` … holy fuck this function was so much worse
than it needed to be. This refactoring includes:

- Descriptive variable names where possible
- More code comments indicating what even is happening
- Shuffled the control flow around to be more linear (move early return
conditions up, etc.) and have less rightwards-drift, to increase
readability
- Extracted `mergeAttrs` function for future changes and readability

Change-Id: I7253b47ce4910fdc67aa7d6edff2f3c0bb8fa55b
2025-11-24 19:16:27 +00:00
piegames 4ce8d809ea libexpr/parser: Fix small error position mistake
In one of the cases it pointed to the first instead of the second
occurence, which is a bit confusing

Change-Id: Ie508d1f84feb434708804d45aa8a9c8b1e3c5f69
2025-11-24 19:16:27 +00:00
piegames 6da3519297 tests/functional2/lang: Move some tests around
Change-Id: I7d87c6c210015b33091876e6656f7c0116bc12ea
2025-11-24 16:31:29 +01:00
piegames 45e4bec59e tests/functional2/lang: Refactor test outputs
How long do we have the value printer already? It's time to stop
concatenating strings like it's 2005

Change-Id: I3f5074de2439a1ad78af94de877bb141bc9f1d82
2025-11-24 16:31:29 +01:00
piegames daefbb8a44 tests/functional2/lang: Migrate more builtins
Change-Id: Ib981a5c544748475cf98a8daae0609a52c9c6eb9
2025-11-18 13:48:32 +00:00
piegames 2df8dc1178 tests/functional2/lang: Migrate string-context tests
Change-Id: I8c8f691f77eb87b52343d52a1c2a8a255ea2c887
2025-11-18 13:48:32 +00:00
piegames dbb6098ff4 tests/functional2/lang: Migrate attrs tests
Change-Id: I8eee261d76d34c4a138bc24d9c2b9a0dfb944c7f
2025-11-18 13:48:32 +00:00
piegames a852ceb0c8 tests/functional2/lang: Migrate autoargs
autoargs get their own folder and are not allowed with the other
function args tests, just like they deserve their own ring of hell

It shall be noted though that this test is particularly pointless, as it
merely tests the normal argument passing (which is fine), and not the
magic autoargs actually provide

Change-Id: Ia2dc00754a13c02e4926200141f90bc797820a15
2025-11-18 13:48:32 +00:00
piegames d470530ec7 tests/functional2/lang: Migrate lists
That one is a bit confusing, as I renamed the old `in` test to `in-2`
(file identities in Git when)

Change-Id: Id0e17de414dbc1b1b616d456175704f98657a16a
2025-11-18 13:48:32 +00:00
piegames 68fdce3548 tests/functional2/lang: Migrate eval-okay-patterns
Change-Id: I46e155ed2cc1ffcb75935fc1744c7938af22c0c6
2025-11-17 22:10:11 +00:00
piegames db59bb63c8 tests/functional2/lang: Migrate eval-okay-print
Change-Id: I70936bcf324dbb8b45a3c65567b6c25f409d7953
2025-11-17 22:10:11 +00:00
piegames 1dc174b4df tests/functional2/lang: Rename ind-string → string-indented
To make it easier to find them and increase locality

Change-Id: I6365e91d2c79362c05b766415cc1972346d7a610
2025-11-17 22:10:11 +00:00
piegames 7a005ebe5d tests/functional2/lang: Migrate eval-okay-backslash-newline-*
It's a string test, so in the string ~~hole~~ folder it goes

Change-Id: Id70da8a7a3de328bc94d2106a53eb7484c4ef122
2025-11-17 22:10:11 +00:00
piegames e6a672d024 tests/functional2/lang: Migrate builtins.toXML
Change-Id: I31f47b9953ef0370dd8e57f6e43ee32d278c3663
2025-11-17 22:10:11 +00:00
piegames ab764d9831 tests/functional2/lang: Migrate builtins.compareVersions, builtins.parseDrvName
Change-Id: I82bbe7f406aa37bc5493c58a8f8bfa5820503632
2025-11-17 22:10:11 +00:00
piegames 776bb81e28 tests/functional2/lang: Migrate builtins.readFile
Change-Id: Ib4d6b0af7e012297692b602cbaafef6a0480129b
2025-11-17 22:10:11 +00:00
piegames 4aedfd346f tests/functional2/lang: Migrate builtins.readDir
Change-Id: Ic70e4ef7780281f403d0421d63ecf849e083c01e
2025-11-17 22:10:11 +00:00
piegames c350bf8b5e tests/functional2/lang: Migrate builtins.readFileType
Change-Id: I7f6c4cddb8d969cb45652e1f72c0001a0ebd2d38
2025-11-17 22:10:11 +00:00
piegames e7bd41ece6 tests/functional2/lang: Migrate search-path test
Change-Id: If7513252cff92831822438753a78c2e9f80ac06b
2025-11-17 22:10:11 +00:00
piegames ca41ea5e3b tests/functional2/lang: Migrate builtins.seq
Change-Id: Ifeb975c0569b196e44054d23c20d22c0481ea3af
2025-11-17 22:10:11 +00:00
piegames 8b33caa506 tests/functional2/lang: Migrate builtins.path
Change-Id: Iefe96d38f89bc730b8e673069f9eb0bd3546accf
2025-11-17 22:10:11 +00:00
piegames 449ddbe324 tests/functional2/lang: Migrate builtins.toJSON
Change-Id: Ic740ab1fe0792c7e7596ae8a9beb9e76b37d6284
2025-11-17 22:10:11 +00:00
piegames eba84b51d6 tests/functional2/lang: Migrate builtins.fromTOML
Change-Id: I80d4058f3b74e9815425499e21afce5fc5dc6375
2025-11-17 22:10:11 +00:00
piegames 721db28037 tests/functional2/lang: Migrate eof tests
Call it a bug, call it a feature, but the old testing framework
ungracefully shits itself when it has no tests to run … in other words,
we finally migrated all the parse-fail tests 🎉

Change-Id: Ibd7f1c04d9a396a20f14361af7924f0074d1ac23
2025-11-17 22:10:11 +00:00
piegames cbac63cfe5 tests/functional2/lang: Migrate builtins.fromJSON
Change-Id: I7828e006eb31f7e4976fcac10ca3529b6b29a700
2025-11-17 22:10:11 +00:00
piegames cb29f3b060 tests/functional2/lang: Migrate merge-attrs tests
Change-Id: Ib8b8e4505454c5061d596dd490db43471bfb754b
2025-11-17 22:10:11 +00:00
piegames 5f7e032d28 tests/functional2/lang: Migrate eol tests
Also slightly refactor the existing crlf test to better fit in

Change-Id: Ib4dfa4b3318b3dd55a12d99a9f4908cdf1bce08b
2025-11-17 22:10:11 +00:00
piegames b912f91f62 tests/functional2/lang: Migrate with tests
Change-Id: I3a6c2fb38569711d717f8488c7a949a4afbea675
2025-11-17 22:10:11 +00:00
piegames 1a5fddbf99 tests/functional2/lang: Merge tests
Change-Id: Ia62b1b558e67b18c1998207824271826b9a707db
2025-11-17 22:10:11 +00:00
piegames 59dd03bc39 tests/functional2/lang: Migrate undefined-var tests
The second test has also been fixed. I'd do it in two commits if
functional1 wasn't such a PITA (guess why we're doing the migration …).

Basically, the introduced syntax got changed later on, but the test
never got updated, and back then tests didn't test the output so nobody
ever noticed it now failing for a wrong reason.

Change-Id: I5b66127d507c65676b8dd4a82d1e1f2857fef145
2025-11-17 22:10:11 +00:00
piegames 108beda9ae tests/functional2/lang: Migrate another weird regression test
A link to an issue would have come really handy …

Change-Id: I44495a5e193c0bfbf9e905271025b7321daa84c6
2025-11-17 22:10:11 +00:00
piegames fef822494e tests/functional2/lang: Drop trivial "parse-okay-1"
This really looks like one of the first tests ever written, it doesn't
seem to be actively testing anything interesting

Change-Id: I442840db932203c25da2d8400ada791f8aed04ce
2025-11-17 22:10:11 +00:00
piegames d864159f34 tests/functional2/lang: Migrate url-literals test
Change-Id: I9096037b3e246dc6e63adcc8f327398bf14518a5
2025-11-17 22:10:11 +00:00
piegames 5bbd2946fa tests/functional2/lang: Migrate let tests
Change-Id: Ia3fc85dafbfd706d719f1766544f836df23ef7c9
2025-11-17 22:10:11 +00:00
piegames ad5d044b35 tests/functional2/lang: Migrate builtins.foldl'
Change-Id: I244751eee4881794f7a5b810e19e7d19f1257999
2025-11-17 22:10:11 +00:00
piegames 7bb79d0ae6 tests/functional2/lang: Migrate rec-set-overrides tests
Change-Id: I2ffc949773188d9b98629df87ac0d2fbf7b2ee6f
2025-11-17 22:10:11 +00:00
piegames fdfe21954f tests/functional2/lang: Migrate builtins.unsafeGetAttrPos tests
Change-Id: I6b1bd29bd03467715c985ae7ecb50c584ed48e11
2025-11-17 22:10:11 +00:00
piegames d0ef150349 tests/functional2/lang: Migrate builtins.hashFile tests
Change-Id: I2e1c1af59daf8c976877f5ec09153464e7480aea
2025-11-17 22:10:11 +00:00
piegames 2a622d7de7 tests/functional2/lang: Migrate value printing tests
Change-Id: I39303ef44552eb9fc17ccc2da5206c8906e46f27
2025-09-18 23:38:46 +02:00
piegames fe7a8d5e67 tests/functional2/lang: Migrate arithmetic tests
Change-Id: I73259875debc053dca46fe34f9f8d10b8486fa4f
2025-09-18 23:38:46 +02:00
piegames 096aa37cf1 tests/functional2/lang: Migrate ind-string tests
Change-Id: Ibc764ab97a53b751287654300211f3a9d8750b74
2025-09-18 23:38:46 +02:00
piegames 21a0b81a26 tests/functional2/lang: Migrate function args tests
Change-Id: Ia805d7fbf74c671fc419fb8c9db3960b6be62354
2025-09-18 23:38:46 +02:00
piegames f2b64142a9 tests/functional2/lang: Migrate dup-attrs tests
Change-Id: Ia5976229c8b2e6bf89d821b5676a9a397e4539d7
2025-09-18 23:38:46 +02:00
piegames 0d4a6132dc tests/functional2/lang: Migrate builtins.deepSeq test
Change-Id: I5caeb8a606d8cba519267c6011561afc9813598c
2025-09-18 23:38:46 +02:00
piegames 3692cf1ea2 tests/functional2/lang: Migrate inherit tests
Change-Id: I0f09f2b4ffa2edc5031351d0426865d7605ff7fa
2025-09-18 23:38:46 +02:00
piegames c7b8ac7cd9 tests/functional2/lang: Migrate substring tests
Change-Id: I902de6f3aebc902d56a79f8909bd6c9b5ba70cda
2025-09-18 23:38:46 +02:00
piegames 81baa64847 tests/functional2/lang: Migrate eval-okay-eq*
Change-Id: I17f81a765bbdbde3a27dd547e1ef65bffa97bce5
2025-09-18 23:38:46 +02:00
piegames 16db4da8f0 tests/functional2/lang: Rename tests
Most tests for builtins now have `builtins.builtinName` as their name.
This makes navigating the test list a bit easier

Change-Id: Ief5af5c568a419bf9130601f9590e7a696b0dc0a
2025-09-18 23:38:46 +02:00
piegames 5cfe785352 tests/functional2/lang: More trivial eval-okay test migrations
In the first pass I erred on the cautious side, only migrating safe
bets, to here's some trivial migrations that I missed

Change-Id: I934011919837b0aa491113afdcad603cf6b9cbbb
2025-09-18 23:38:46 +02:00
piegames 019b17f4e9 tests/functional2/lang: Migrate trivial eval-okay tests
Change-Id: I07a2e70eacd3d7bca3fc4d7074b9892b9ea35346
2025-06-02 21:52:34 +02:00
piegames 9673c6480a tests/functional2/lang: Migrate trivial parse-okay tests
Change-Id: I11b6ea26b7dc6bcf8250c04d3c97ded452dd1eda
2025-06-02 21:52:34 +02:00
piegames 0219434ae9 tests/functional2/lang: Migrate trivial parse-fail tests
Change-Id: If6cd6a2432c081e4b918f480ce3be0da3e691d40
2025-06-02 21:52:34 +02:00
piegames 63edb9c678 tests/functional2/lang: Migrate trivial eval-fail tests
All changes are uniform and done with the same script, so checking only
some should suffice. For that reason, any tests involving multiple files
or custom CLI flags are not included in this commit.

Change-Id: Ib2d0e08937b56e241d99771a58aad34ed3ad308a
2025-06-02 21:52:34 +02:00
piegames a7e5ff0070 tests/functional2: Make symlink handling less confusing
The current `RelativeTo` design is both more complex and more confusing
than necessary. Its four variants are now reduced to only two. They are
now also represented as different classes, to better communicate the
difference in semantics and also intent.

Change-Id: Ia60fc7a2dfa0f62bdef90dde347fd8603fd3fbf9
2025-06-02 21:52:34 +02:00
piegames 1071643259 tests/functional/lang: Clean up lib.nix
That file was written once in 2008 and never updated since, and let's
just say that a lot of things have changed since

Change-Id: I66b0c87ecbba6ca653470966c9514edb21882ca3
2025-05-24 08:49:09 +02:00
piegames 5d49e26f71 tests/functional/lang: Remove disabled tail-call test
It was introduced back in 2013, was disabled in 2014 again for dubious
reasons and according to horrors is unsound anyways and can never really
work.

It was the only disabled test, so I removed the "infrastructure" for
that in the test runner as well. functional2/lang will have much better
ways for skipping tests anyways

Change-Id: Icb8697fb85221e3206fb64cb917c03607ef278a7
2025-05-22 01:48:34 +02:00
piegames 76d6b51f5c tests/functional/lang: Don't pipe input into stdin
Back in the days, this used to be the modus operandi, but then, still
many but less years ago, Eelco came along and changed it to passing in
the actual file. Of course, no motivation was provided, and it was only
done on half of the test runners for some reason, leaving us to wonder
what the true intentions of this code are …

Anyways, with this commit now everything standardises on passing in the
file by path instead of via stdin. Motivation:

- We need to `sed` out the path anyways for various other reasons,
including import tests and path value tests
- Given that, the presumed primary motivation for using stdin in the
first place becomes moot
- Bonus points for giving better error messages, especially in tests
that involve multiple input files

Change-Id: Ic6de1ec24f4c4d3c05e33d1ee053614784677513
2025-05-22 01:48:34 +02:00
piegamesandCommentator2.0 e52cad0285 tests/functional/lang: Don't use tabs for indentation
Don't ask me the fuck why, but *somehow* Nix prints error locations
differently if the input file is passed as a path vs through stdin, and
I have a hunch that this might have to do with tabs

Change-Id: I186b0edb90edd48856da3621815463e372c37512
2025-05-21 20:36:20 +02:00
piegamesandCommentator2.0 e2944876cc tests/functional/lang: Change base path to the lang directory
Currently, all tests are relative to `./tests/functional` instead of
`./tests/functional/lang`. Whether this is a historical artefact or as
intended, the current move is to align the tests with the new design of
functional2, preparing them for an easier migration.

Change-Id: Ie394691b071488a8000a005080b9167786d5bd9a
2025-05-21 20:36:20 +02:00
piegames 0fbbb1e49b libexpr: Switch StaticEnv to LinearMap
Change-Id: If98bfafce9fa5235fe962274c03c619fe965dd60
2025-05-19 16:21:10 +02:00
piegames bd8ec106fa libutil: Introduce LinearMap
Change-Id: I68ce4c1dc17b0742690e49f62206c65f5a1a4a30
2025-05-19 15:35:52 +02:00
2b22dae1ba lixexpr: Declutter error traces
Now that we can correctly point to all expressions, we can remove
redundant intermediate traces to reduce clutter.

Co-authored-by: eldritch horrors <pennae@lix.systems>
Co-authored-by: Raito Bezarius <raito@lix.systems>
Change-Id: I3e9d7c1c7a6599a8e68302448bbb961d051002b7
2025-04-24 20:44:57 +02:00