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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,8 @@
let { let
as = { x = 123; y = 456; } // { z = 789; } // { z = 987; }; as = { x = 123; y = 456; } // { z = 789; } // { z = 987; };
in
body = if as ? a then as.a else assert as ? z; as.z; 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; }; as = { x = 123; y = 456; } // { z = 789; } // { z = 987; };
A = "a"; A = "a";
Z = "z"; Z = "z";
body = if builtins.hasAttr A as in
then builtins.getAttr A as if builtins.hasAttr A as then
else assert builtins.hasAttr Z as; builtins.getAttr Z as; 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;
assert !builtins ? __currentSystem; assert !builtins ? __currentSystem;
let { let
x = if builtins ? dirOf then builtins.dirOf /foo/bar else ""; x = if builtins ? dirOf then builtins.dirOf /foo/bar else "";
y = if builtins ? fnord then builtins.fnord "foo" 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; with import ./lib.nix;
let { let
l = ["1" "2" ["3" ["4"] ["5" "6"]] "7"]; 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; with import ./lib.nix;
let { concat ["foo" "bar" "bla" "test"]
body = concat ["foo" "bar" "bla" "test"];
}

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
let { rec {
as = { as = {
x = 123; x = 123;
@ -9,5 +9,5 @@ let {
x = 789; x = 789;
inherit (as) x; inherit (as) x;
}; };
} }

View file

@ -1,4 +1,4 @@
let { rec {
as = { as = {
x = 123; x = 123;
@ -9,5 +9,5 @@ let {
x = 789; x = 789;
inherit (as) x; inherit (as) x;
}; };
} }

View file

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

View file

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

View file

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