nix/src/libexpr
Ryan Hendrickson da332d678e libexpr: deprecate the bogus "or"-as-variable
As a prelude to making "or" work like a normal variable, emit a warning
any time the "fn or" production is used in a context that will change
how it is parsed when that production is refactored.

In detail: in the future, OR_KW will be moved to expr_simple, and the
cursed ExprCall production that is currently part of the expr_select
nonterminal will be generated "normally" in expr_app instead. Any
productions that accept an expr_select will be affected, except for the
expr_app nonterminal itself (because, while expr_app has a production
accepting a bare expr_select, its other production will continue to
accept "fn or" expressions). So all we need to do is emit an appropriate
warning when an expr_simple representing a cursed ExprCall is accepted
in one of those productions without first going through expr_app.

As the warning message describes, users can suppress the warning by
wrapping their problematic "fn or" expressions in parentheses. For
example, "f g or" can be made future-proof by rewriting it as
"f (g or)"; similarly "[ x y or ]" can be rewritten as "[ x (y or) ]",
etc. The parentheses preserve the current grouping behavior, as in the
future "f g or" will be parsed as "(f g) or", just like
"f g anything-else" is grouped. (Mechanically, this suppresses the
warning because the problem ExprCalls go through the
"expr_app : expr_select" production, which resets the cursed status on
the ExprCall.)
2024-09-20 15:57:36 -04:00
..
primops fetchers::downloadTarball(): Return a cacheable accessor 2024-08-12 15:48:26 +02:00
value Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
.version Meson build for libexpr and libflake 2024-07-02 09:23:24 -04:00
attr-path.cc Make abort() call sites log first 2024-07-24 16:52:04 +02:00
attr-path.hh Merge remote-tracking branch 'upstream/master' into source-path 2023-04-17 11:41:50 +02:00
attr-set.cc Never update values after setting the type 2024-03-25 19:21:25 +01:00
attr-set.hh Remove comparator.hh and switch to <=> in a bunch of places 2024-07-12 14:54:18 -04:00
build-utils-meson Rename file to avoid reserved name 2024-07-02 09:26:22 -04:00
call-flake.nix More fixes 2024-07-02 09:26:22 -04:00
eval-cache.cc Use envvars NIX_CACHE_HOME, NIX_CONFIG_HOME, NIX_DATA_HOME, NIX_STATE_HOME if defined (#11351) 2024-09-11 10:36:46 +00:00
eval-cache.hh Fix warning 2024-06-10 12:46:04 +02:00
eval-error.cc Add EvalErrorBuilder::panic() 2024-07-11 11:35:58 +02:00
eval-error.hh Merge pull request #11043 from hercules-ci/assert-eq 2024-07-22 17:34:28 +02:00
eval-gc.cc Merge remote-tracking branch 'origin/master' into flip-coroutines 2024-08-20 17:19:17 +02:00
eval-gc.hh Fix build without GC 2024-09-20 15:01:32 +02:00
eval-inline.hh refactor: Extract EvalState::addCallDepth 2024-08-15 13:04:34 +02:00
eval-settings.cc Use envvars NIX_CACHE_HOME, NIX_CONFIG_HOME, NIX_DATA_HOME, NIX_STATE_HOME if defined (#11351) 2024-09-11 10:36:46 +00:00
eval-settings.hh docs: explain provenance of default nix-path values 2024-09-05 04:35:06 +02:00
eval.cc Add a few more aliases 2024-09-19 21:04:01 +02:00
eval.hh Alias traceable_allocator to std::allocator when building without GC 2024-09-19 21:04:01 +02:00
fetchurl.nix builtin:fetchurl: Revert impureEnvVars attribute 2024-05-07 11:25:07 +02:00
function-trace.cc Revert the enum struct change 2020-06-18 22:11:26 +00:00
function-trace.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
gc-small-vector.hh Alias traceable_allocator to std::allocator when building without GC 2024-09-19 21:04:01 +02:00
get-drvs.cc language: cleanly ban integer overflows 2024-07-30 18:13:05 -07:00
get-drvs.hh Alias traceable_allocator to std::allocator when building without GC 2024-09-19 21:04:01 +02:00
imported-drv-to-derivation.nix Move some corepkgs into the nix binary 2020-03-11 16:57:48 +01:00
json-to-value.cc language: cleanly ban integer overflows 2024-07-30 18:13:05 -07:00
json-to-value.hh libexpr: Support structured error classes 2024-02-01 16:39:38 -08:00
lexer-helpers.cc libexpr: Rename "column" fields to offset 2024-07-15 19:56:40 +02:00
lexer-helpers.hh libexpr: Rearrange lexer files so that yylex_init_extra can be found 2024-07-15 19:56:40 +02:00
lexer.l language: cleanly ban integer overflows 2024-07-30 18:13:05 -07:00
local.mk More fixes 2024-07-02 09:26:22 -04:00
meson.build Make sure we use -isystem with Meson on some deps 2024-07-29 13:06:26 -04:00
meson.options Meson build for libexpr and libflake 2024-07-02 09:23:24 -04:00
nix-expr.pc.in Fix building with GCC 9 2023-02-10 18:38:57 +01:00
nixexpr.cc libexpr: deprecate the bogus "or"-as-variable 2024-09-20 15:57:36 -04:00
nixexpr.hh libexpr: deprecate the bogus "or"-as-variable 2024-09-20 15:57:36 -04:00
package.nix Deduplicate our many package.nix a bit (#11175) 2024-07-25 03:12:39 +00:00
parser-state.hh parser.y: GLR -> LALR 2024-07-25 15:48:58 -04:00
parser.y libexpr: deprecate the bogus "or"-as-variable 2024-09-20 15:57:36 -04:00
paths.cc Get rid of CanonPath::fromCwd 2024-02-08 11:01:41 -05:00
pos-idx.hh Simplify PosIdx::hash() 2024-07-17 13:31:31 +02:00
pos-table.hh Solve unused header warnings reported by clangd 2024-07-12 15:37:54 +02:00
primops.cc Alias gc_allocator 2024-09-19 21:04:01 +02:00
primops.hh use byte indexed locations for PosIdx 2024-03-06 23:48:42 +01:00
print-ambiguous.cc Make abort() call sites log first 2024-07-24 16:52:04 +02:00
print-ambiguous.hh Restore ambiguous value printer for nix-instantiate 2024-01-11 16:34:36 -08:00
print-options.hh Print top-level errors normally in nix repl 2024-03-09 18:28:04 -08:00
print.cc Make abort() call sites log first 2024-07-24 16:52:04 +02:00
print.hh Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
repl-exit-status.hh :quit in the debugger should quit the whole program 2024-02-20 10:01:13 -08:00
search-path.cc Rename SearchPath to LookupPath and searchPath to lookupPath 2024-04-13 17:35:15 +02:00
search-path.hh Build a minimized Nix with MinGW 2024-04-17 12:26:10 -04:00
symbol-table.hh Merge pull request #11191 from DeterminateSystems/hash-symbol 2024-07-29 15:30:37 +02:00
value-to-json.cc language: cleanly ban integer overflows 2024-07-30 18:13:05 -07:00
value-to-json.hh Use std::set<StringContextElem> not PathSet for string contexts 2023-04-21 01:05:49 -04:00
value-to-xml.cc SymbolStr: Remove std::string conversion 2024-07-11 17:43:10 +02:00
value-to-xml.hh Use std::set<StringContextElem> not PathSet for string contexts 2023-04-21 01:05:49 -04:00
value.hh Move GC-related definitions to eval-gc.hh 2024-09-19 21:04:01 +02:00