mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Fix underflow in Printer::printList
Analogous to 9b88bf8adf
/ three commits back
This commit is contained in:
parent
bfc5416240
commit
b2c7f09b0a
3 changed files with 25 additions and 1 deletions
|
@ -405,11 +405,14 @@ private:
|
||||||
output << "[";
|
output << "[";
|
||||||
auto listItems = v.listItems();
|
auto listItems = v.listItems();
|
||||||
auto prettyPrint = shouldPrettyPrintList(listItems);
|
auto prettyPrint = shouldPrettyPrintList(listItems);
|
||||||
|
|
||||||
|
size_t currentListItemsPrinted = 0;
|
||||||
|
|
||||||
for (auto elem : listItems) {
|
for (auto elem : listItems) {
|
||||||
printSpace(prettyPrint);
|
printSpace(prettyPrint);
|
||||||
|
|
||||||
if (totalListItemsPrinted >= options.maxListItems) {
|
if (totalListItemsPrinted >= options.maxListItems) {
|
||||||
printElided(listItems.size() - totalListItemsPrinted, "item", "items");
|
printElided(listItems.size() - currentListItemsPrinted, "item", "items");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +422,7 @@ private:
|
||||||
printNullptr();
|
printNullptr();
|
||||||
}
|
}
|
||||||
totalListItemsPrinted++;
|
totalListItemsPrinted++;
|
||||||
|
currentListItemsPrinted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
decreaseIndent();
|
decreaseIndent();
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
error:
|
||||||
|
… while evaluating a path segment
|
||||||
|
at /pwd/lang/eval-fail-nested-list-items.nix:11:6:
|
||||||
|
10|
|
||||||
|
11| "" + (let v = [ [ 1 2 3 4 5 6 7 8 ] [1 2 3 4]]; in builtins.deepSeq v v)
|
||||||
|
| ^
|
||||||
|
12|
|
||||||
|
|
||||||
|
error: cannot coerce a list to a string: [ [ 1 2 3 4 5 6 7 8 ] [ 1 «3 items elided» ] ]
|
11
tests/functional/lang/eval-fail-nested-list-items.nix
Normal file
11
tests/functional/lang/eval-fail-nested-list-items.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# This reproduces https://github.com/NixOS/nix/issues/10993, for lists
|
||||||
|
# $ nix run nix/2.23.1 -- eval --expr '"" + (let v = [ [ 1 2 3 4 5 6 7 8 ] [1 2 3 4]]; in builtins.deepSeq v v)'
|
||||||
|
# error:
|
||||||
|
# … while evaluating a path segment
|
||||||
|
# at «string»:1:6:
|
||||||
|
# 1| "" + (let v = [ [ 1 2 3 4 5 6 7 8 ] [1 2 3 4]]; in builtins.deepSeq v v)
|
||||||
|
# | ^
|
||||||
|
#
|
||||||
|
# error: cannot coerce a list to a string: [ [ 1 2 3 4 5 6 7 8 ] [ 1 «4294967290 items elided» ] ]
|
||||||
|
|
||||||
|
"" + (let v = [ [ 1 2 3 4 5 6 7 8 ] [1 2 3 4]]; in builtins.deepSeq v v)
|
Loading…
Reference in a new issue