treewide: Stop using ancient let syntax

Shows for how long these tests have not been touched by anyone …

Change-Id: I3d0c1209a86283ddb012db4e7d45073264fdd0eb
This commit is contained in:
piegames 2024-08-18 17:28:04 +02:00
parent 7210ed1b87
commit 0a8888d1c7
23 changed files with 97 additions and 141 deletions

View file

@ -1,28 +1,21 @@
error:
… while evaluating the attribute 'body'
at /pwd/lang/eval-fail-assert.nix:4:3:
3|
4| body = x "x";
| ^
5| }
… from call site
at /pwd/lang/eval-fail-assert.nix:4:10:
3|
4| body = x "x";
| ^
5| }
at /pwd/lang/eval-fail-assert.nix:4:1:
3| in
4| x "x"
| ^
5|
… while calling 'x'
at /pwd/lang/eval-fail-assert.nix:2:7:
1| let {
1| let
2| x = arg: assert arg == "y"; 123;
| ^
3|
3| in
error: assertion '(arg == "y")' failed
at /pwd/lang/eval-fail-assert.nix:2:12:
1| let {
1| let
2| x = arg: assert arg == "y"; 123;
| ^
3|
3| in

View file

@ -1,5 +1,4 @@
let {
let
x = arg: assert arg == "y"; 123;
body = x "x";
}
in
x "x"

View file

@ -1,14 +1,6 @@
error:
… while evaluating the attribute 'body'
at /pwd/lang/eval-fail-blackhole.nix:2:3:
1| let {
2| body = x;
| ^
3| x = y;
error: infinite recursion encountered
at /pwd/lang/eval-fail-blackhole.nix:3:7:
2| body = x;
3| x = y;
error: infinite recursion encountered
at /pwd/lang/eval-fail-blackhole.nix:2:7:
1| let
2| x = y;
| ^
4| y = x;
3| y = x;

View file

@ -1,5 +1,5 @@
let {
body = x;
let
x = y;
y = x;
}
in
x

View file

@ -1,15 +1,7 @@
error:
… while evaluating the attribute 'body'
at /pwd/lang/eval-fail-remove.nix:4:3:
3|
4| body = (removeAttrs attrs ["x"]).x;
error: attribute 'x' missing
at /pwd/lang/eval-fail-remove.nix:4:3:
3| in
4| (removeAttrs attrs ["x"]).x
| ^
5| }
error: attribute 'x' missing
at /pwd/lang/eval-fail-remove.nix:4:10:
3|
4| body = (removeAttrs attrs ["x"]).x;
| ^
5| }
5|
Did you mean y?

View file

@ -1,5 +1,4 @@
let {
let
attrs = {x = 123; y = 456;};
body = (removeAttrs attrs ["x"]).x;
}
in
(removeAttrs attrs ["x"]).x

View file

@ -1,28 +1,21 @@
error:
… while evaluating the attribute 'body'
at /pwd/lang/eval-fail-scope-5.nix:8:3:
7|
8| body = f {};
| ^
9|
… from call site
at /pwd/lang/eval-fail-scope-5.nix:8:10:
7|
8| body = f {};
| ^
9|
at /pwd/lang/eval-fail-scope-5.nix:7:3:
6| in
7| f {}
| ^
8|
… while calling 'f'
at /pwd/lang/eval-fail-scope-5.nix:6:7:
5|
6| f = {x ? y, y ? x}: x + y;
at /pwd/lang/eval-fail-scope-5.nix:5:7:
4|
5| f = {x ? y, y ? x}: x + y;
| ^
7|
6| in
error: infinite recursion encountered
at /pwd/lang/eval-fail-scope-5.nix:6:12:
5|
6| f = {x ? y, y ? x}: x + y;
at /pwd/lang/eval-fail-scope-5.nix:5:12:
4|
5| f = {x ? y, y ? x}: x + y;
| ^
7|
6| in

View file

@ -1,10 +1,7 @@
let {
let
x = "a";
y = "b";
f = {x ? y, y ? x}: x + y;
body = f {};
}
in
f {}

View file

@ -1,6 +1,6 @@
with import ./lib.nix;
let {
let
/* Supposedly tail recursive version:
@ -15,7 +15,8 @@ let {
err = abort "urgh";
body = sum
in
sum
[ (sum (range 1 50))
(123 + 456)
(0 + -10 + -(-11) + -x)
@ -54,6 +55,5 @@ let {
(if "aa" < "ab" then 1 else err)
(if "aa" < "aa" then err else 1)
(if "foo" < "foobar" then 1 else err)
];
]
}

View file

@ -1,5 +1,8 @@
let {
let
as = { x = 123; y = 456; } // { z = 789; } // { z = 987; };
body = if as ? a then as.a else assert as ? z; as.z;
}
in
if as ? a then
as.a
else
assert as ? z;
as.z

View file

@ -1,10 +1,11 @@
let {
let
as = { x = 123; y = 456; } // { z = 789; } // { z = 987; };
A = "a";
Z = "z";
body = if builtins.hasAttr A as
then builtins.getAttr A as
else assert builtins.hasAttr Z as; builtins.getAttr Z as;
}
in
if builtins.hasAttr A as then
builtins.getAttr A as
else
assert builtins.hasAttr Z as; builtins.getAttr Z as

View file

@ -1,12 +1,11 @@
assert builtins ? currentSystem;
assert !builtins ? __currentSystem;
let {
let
x = if builtins ? dirOf then builtins.dirOf /foo/bar else "";
y = if builtins ? fnord then builtins.fnord "foo" else "";
body = x + y;
}
in
x + y

View file

@ -1,8 +1,8 @@
with import ./lib.nix;
let {
let
l = ["1" "2" ["3" ["4"] ["5" "6"]] "7"];
body = concat (flatten l);
}
in
concat (flatten l)

View file

@ -1,7 +1,3 @@
with import ./lib.nix;
let {
body = concat ["foo" "bar" "bla" "test"];
}
concat ["foo" "bar" "bla" "test"]

View file

@ -1,5 +1,4 @@
let {
let
attrs = {x = 123; y = 456;};
body = (removeAttrs attrs ["x"]).y;
}
in
(removeAttrs attrs ["x"]).y

View file

@ -1,10 +1,7 @@
let {
let
x = "a";
y = "b";
f = {x ? y, y ? x}: x + y;
body = f {x = "c";} + f {y = "d";};
}
in
f {x = "c";} + f {y = "d";}

View file

@ -1,7 +1,5 @@
let {
let
f = {x ? y, y ? x}: x + y;
body = f {x = "c";} + f {y = "d";};
}
in
f {x = "c";} + f {y = "d";}

View file

@ -1,4 +1,4 @@
let {
let
a = "xyzzy";
@ -15,5 +15,5 @@ let {
y = with as; with bs; a + b;
body = x + y;
}
in
x + y

View file

@ -1,4 +1,4 @@
let {
rec {
as = {
x = 123;

View file

@ -1,4 +1,4 @@
let {
rec {
as = {
x = 123;

View file

@ -1,6 +1,6 @@
error: undefined variable 'gcc'
at «stdin»:9:13:
8| body = ({
9| inherit gcc;
| ^
10| }).gcc;
at «stdin»:9:11:
8| ({
9| inherit gcc;
| ^
10| }).gcc

View file

@ -1,11 +1,10 @@
let {
let
x =
{gcc}:
{
inherit gcc;
};
body = ({
inherit gcc;
}).gcc;
}
in
({
inherit gcc;
}).gcc

View file

@ -1,7 +1,6 @@
let {
let
f = {x, y : ["baz" "bar" z "bat"]}: x + y;
body = f {x = "foo"; y = "bar";};
}
in
f {x = "foo"; y = "bar";}