mirror of
https://github.com/NixOS/nix
synced 2025-07-09 07:53:55 +02:00
Merge pull request #11560 from rhendric/rhendric/deprecate-cursed-or
libexpr: deprecate the bogus "or"-as-variable
This commit is contained in:
commit
f5a2f2a8f8
6 changed files with 79 additions and 8 deletions
12
tests/functional/lang/eval-okay-deprecate-cursed-or.err.exp
Normal file
12
tests/functional/lang/eval-okay-deprecate-cursed-or.err.exp
Normal file
|
@ -0,0 +1,12 @@
|
|||
warning: at /pwd/lang/eval-okay-deprecate-cursed-or.nix:3:47: This expression uses `or` as an identifier in a way that will change in a future Nix release.
|
||||
Wrap this entire expression in parentheses to preserve its current meaning:
|
||||
((x: x) or)
|
||||
Give feedback at https://github.com/NixOS/nix/pull/11121
|
||||
warning: at /pwd/lang/eval-okay-deprecate-cursed-or.nix:4:39: This expression uses `or` as an identifier in a way that will change in a future Nix release.
|
||||
Wrap this entire expression in parentheses to preserve its current meaning:
|
||||
((x: x + 1) or)
|
||||
Give feedback at https://github.com/NixOS/nix/pull/11121
|
||||
warning: at /pwd/lang/eval-okay-deprecate-cursed-or.nix:5:44: This expression uses `or` as an identifier in a way that will change in a future Nix release.
|
||||
Wrap this entire expression in parentheses to preserve its current meaning:
|
||||
((x: x) or)
|
||||
Give feedback at https://github.com/NixOS/nix/pull/11121
|
1
tests/functional/lang/eval-okay-deprecate-cursed-or.exp
Normal file
1
tests/functional/lang/eval-okay-deprecate-cursed-or.exp
Normal file
|
@ -0,0 +1 @@
|
|||
0
|
11
tests/functional/lang/eval-okay-deprecate-cursed-or.nix
Normal file
11
tests/functional/lang/eval-okay-deprecate-cursed-or.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
let
|
||||
# These are cursed and should warn
|
||||
cursed0 = builtins.length (let or = 1; in [ (x: x) or ]);
|
||||
cursed1 = let or = 1; in (x: x * 2) (x: x + 1) or;
|
||||
cursed2 = let or = 1; in { a = 2; }.a or (x: x) or;
|
||||
|
||||
# These are uses of `or` as an identifier that are not cursed
|
||||
allowed0 = let or = (x: x); in map or [];
|
||||
allowed1 = let f = (x: x); or = f; in f (f or);
|
||||
in
|
||||
0
|
Loading…
Add table
Add a link
Reference in a new issue