Commit graph

16192 commits

Author SHA1 Message Date
pennae a2bf8a66a2 diagnose "unexpected EOF" at EOF
this needs a string comparison because there seems to be no other way to
get that information out of bison. usually the location info is going to
be correct (pointing at a bad token), but since EOF isn't a token as
such it'll be wrong in that this case.

this hasn't shown up much so far because a single line ending *is* a
token, so any file formatted in the usual manner (ie, ending in a line
ending) would have its EOF position reported correctly.
2024-02-26 15:49:57 +01:00
pennae 72396e0038 match line endings used by parser and error reports
the parser treats a plain \r as a newline, error reports do not. this
can lead to interesting divergences if anything makes use of this
feature, with error reports pointing to wrong locations in the input (or
even outside the input altogether).
2024-02-26 15:49:57 +01:00
pennae f7e3a0b19f report inherit attr errors at the duplicate name
previously we reported the error at the beginning of the binding
block (for plain inherits) or the beginning of the attr list (for
inherit-from), effectively hiding where exactly the error happened.

this also carries over to runtime positions of attributes in sets as
reported by unsafeGetAttrPos. we're not worried about this changing
observable eval behavior because it *is* marked unsafe, and the new
behavior is much more useful.
2024-02-26 15:49:56 +01:00
pennae b7cac2b2dc normalize formal order on ExprLambda::show
we already normalize attr order to lexicographic, doing the same for
formals makes sense. doubly so because the order of formals would
otherwise depend on the context of the expression, which is not quite as
useful as one might expect.
2024-02-26 15:44:54 +01:00
pennae f416527164 keep copies of parser inputs that are in-memory only
the parser modifies its inputs, which means that sharing them between
the error context reporting system and the parser itself can confuse the
reporting system. usually this led to early truncation of error context
reports which, while not dangerous, can be quite confusing.
2024-02-26 15:44:54 +01:00
pennae 375cc2438a remove ExprAttrs::AttrDef::inherited
it's no longer widely used and has a rather confusing meaning now that
inherit-from is handled very differently.
2024-02-26 15:37:42 +01:00
pennae a704123ea1 evaluate inherit (from) exprs only once per directive
desugaring inherit-from to syntactic duplication of the source expr also
duplicates side effects of the source expr (such as trace calls) and
expensive computations (such as derivationStrict).
2024-02-26 15:37:40 +01:00
pennae ecf8b12d60 group inherit by source during Expr::show
for plain inherits this is really just a stylistic choice, but for
inherit-from it actually fixes an exponential size increase problem
during expr printing (as may happen during assertion failure reporting,
on during duplicate attr detection in the parser)
2024-02-12 13:58:29 +01:00
pennae 6c08fba533 use the same bindings print for ExprAttrs and ExprLet
this also has the effect of sorting let bindings lexicographically
rather than by symbol creation order as was previously done, giving a
better canonicalization in the process.
2024-02-12 13:35:00 +01:00
pennae 1f542adb3e add ExprAttrs::AttrDef::chooseByKind
in place of inherited() — not quite useful yet since we don't
distinguish plain and inheritFrom attr kinds so far.
2024-02-12 13:34:59 +01:00
pennae c66ee57edc preserve information about whether/how an attribute was inherited 2024-02-12 13:32:33 +01:00
pennae 73065a400d add test for inherit expr printing 2024-02-12 13:32:33 +01:00
pennae 8669c02468 add test for inherit-from semantics 2024-02-12 13:32:33 +01:00
John Ericson 9d182e71fb
Merge pull request #9984 from BOHverkill/fix-manual-link
Fix link to manual in CONTRIBUTING.md
2024-02-11 16:13:06 -05:00
BOHverkill fae8c15737
Fix link to manual in CONTRIBUTING.md 2024-02-10 17:44:33 +01:00
Théophane Hufschmitt 28a988bdde
Merge pull request #9974 from edolstra/less-chatty-post-build-hook
runPostBuildHook(): Be less chatty
2024-02-09 16:39:02 +01:00
Eelco Dolstra fb5a792280 runPostBuildHook(): Be less chatty
Don't spam the user with "running post-build-hook" messages. It's up
to the post-build hook if it has something interesting to say.
2024-02-09 15:55:24 +01:00
Eelco Dolstra 4487ebca66
Merge pull request #9973 from fricklerhandwerk/add-links-gc-confusion
add clickable anchor links
2024-02-09 13:41:18 +01:00
Eelco Dolstra 57ebcadb2f
Merge pull request #9972 from NixOS/allow-unoptimized-builds
Don't hardcode the `-O2` compiler flag
2024-02-09 13:25:51 +01:00
Valentin Gagarin 60045f9c96 add clickable anchor links
how the different invocations relate to each other seems be
confusing, which is relatable because one has to wire it up in your head
while reading. an explicit reference should make it unambiguous and
easier to notice due to links being highlighted.
2024-02-09 10:41:03 +01:00
Théophane Hufschmitt 1fe7b01669
Don't hardcode the -O2 compiler flag
autoconf authors apparently decided that setting `-O2` by default was a good idea. I disagree, and Nix has its own way of deciding that (with `OPTIMIZE={0,1}`). Explicitly set `CFLAGS` and `CXXFLAGS` in the configure script to disable that behaviour.

Fix #9965
2024-02-09 06:27:24 +01:00
Théophane Hufschmitt 47a1dbb4b8
Merge pull request #9925 from 9999years/fmt-cleanup
Cleanup `fmt.hh`
2024-02-09 06:01:03 +01:00
Rebecca Turner 953eb0cba2
Fix tests 2024-02-08 15:55:20 -08:00
Rebecca Turner c0e7f50c1a
Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
Rebecca Turner 149bd63afb
Cleanup fmt.hh
When I started contributing to Nix, I found the mix of definitions and
names in `fmt.hh` to be rather confusing, especially the small
difference between `hintfmt` and `hintformat`. I've renamed many classes
and added documentation to most definitions.

- `formatHelper` is no longer exported.
- `fmt`'s documentation is now with `fmt` rather than (misleadingly)
  above `formatHelper`.
- `yellowtxt` is renamed to `Magenta`.

  `yellowtxt` wraps its value with `ANSI_WARNING`, but `ANSI_WARNING`
  has been equal to `ANSI_MAGENTA` for a long time. Now the name is
  updated.
- `normaltxt` is renamed to `Uncolored`.
- `hintfmt` has been merged into `hintformat` as extra constructor
  functions.
- `hintformat` has been renamed to `hintfmt`.
- The single-argument `hintformat(std::string)` constructor has been
  renamed to a static member `hintformat::interpolate` to avoid pitfalls
  with using user-generated strings as format strings.
2024-02-08 11:51:03 -08:00
Théophane Hufschmitt 1ba9780cf5
Merge pull request #9834 from 9999years/structured-errors
Towards structured error classes
2024-02-08 20:00:25 +01:00
Eelco Dolstra 6563a58294
Merge pull request #9964 from fricklerhandwerk/merge-format-sections
move JSON section into Formats and Protocols
2024-02-08 16:53:59 +01:00
Théophane Hufschmitt a8050d9b83
Merge pull request #9928 from 9999years/error-messages-in-nix-repl
Improve error printing in `nix repl`
2024-02-08 16:21:13 +01:00
Théophane Hufschmitt 96686a2a29
Merge pull request #9963 from fricklerhandwerk/fold-sidebar
manual: fold sidebar sections
2024-02-08 16:18:27 +01:00
John Ericson f2f54cf087
Merge pull request #9863 from obsidiansystems/perl-open-other-store
Support arbitrary stores in Perl bindings
2024-02-08 09:30:18 -05:00
Théophane Hufschmitt 46a0625a40
Merge pull request #9929 from 9999years/dont-print-values-in-magenta
Don't print the first bracket in values in magenta in error messages
2024-02-08 10:56:18 +01:00
Théophane Hufschmitt 9b8b486091
Merge pull request #9933 from pennae/debugger-fix
fix debugger crashing while printing envs
2024-02-08 10:48:02 +01:00
Théophane Hufschmitt acef4f17a2
Merge pull request #9918 from 9999years/debugger-locals-for-let-expressions
Expose locals from `let` expressions to the debugger
2024-02-08 10:17:55 +01:00
Théophane Hufschmitt c4ed92fa6f
Merge pull request #9917 from 9999years/enter-debugger-more-reliably
Enter debugger more reliably in `let` expressions and function calls
2024-02-08 10:09:54 +01:00
Théophane Hufschmitt fb78a99e04
Merge pull request #9924 from 9999years/rename-yellowtxt
Rename `yellowtxt` -> `magentatxt`
2024-02-08 10:01:30 +01:00
Théophane Hufschmitt f388a6148d
Merge pull request #9919 from 9999years/reduce-debugger-clutter
Reduce visual clutter in the debugger
2024-02-08 09:42:38 +01:00
Théophane Hufschmitt d24c8aa491
Simplify a conditional in the repl initialisation 2024-02-08 09:22:30 +01:00
Valentin Gagarin e486b76eef move JSON section into Formats and Protocols 2024-02-08 09:13:58 +01:00
Valentin Gagarin 140de3b278 manual: fold sidebar sections
the table of contents is very long now, and folded sections allow
for a better overview.
2024-02-08 09:00:00 +01:00
John Ericson bc08502249 Support arbitrary stores in Perl bindings
Fix #9859

It's a breaking change but that's fine; we can just update Hydra to use
the new bindings.
2024-02-07 22:31:58 -05:00
Eelco Dolstra 09a6e8e703
Merge pull request #9949 from fricklerhandwerk/fix-redirects-file
fix location of `_redirects` file
2024-02-07 11:34:35 +01:00
Rebecca Turner 9723f533d8
Add comment 2024-02-06 16:50:47 -08:00
Rebecca Turner 474fc4078a
Add comments 2024-02-06 16:49:28 -08:00
Valentin Gagarin 2d74b56aee fix location of _redirects file
the Netlify `_redirects` file must be in the root directory [0] of the
files to serve, and mdBook copies all the files in `src` that aren't
`.md` to the output directory [1].

[0]: https://docs.netlify.com/routing/redirects/
[1]: https://rust-lang.github.io/mdBook/guide/creating.html#source-files
2024-02-06 23:22:34 +01:00
Rebecca Turner 657a607812
Add release note 2024-02-05 13:21:08 -08:00
Rebecca Turner 155bc761f6
Add release note 2024-02-05 13:16:39 -08:00
Rebecca Turner b63a8d7c46
Add release note 2024-02-05 13:15:29 -08:00
Rebecca Turner 601fc7d159
Add release note 2024-02-05 13:13:26 -08:00
Robert Hensing a31f2cb0cd
Merge pull request #9939 from edolstra/slash-operator
CanonPath, SourcePath: Change operator + to /
2024-02-05 15:55:27 +01:00
Eelco Dolstra a6737b7e17 CanonPath, SourcePath: Change operator + to /
This is less confusing and makes it more similar to std::filesystem::path.
2024-02-05 15:17:39 +01:00