From ad467265466dbccc816f550def9455ee720c5d3d Mon Sep 17 00:00:00 2001 From: Alex Ameen Date: Wed, 30 Nov 2022 22:53:41 -0600 Subject: [PATCH 1/3] doc: listToAttrs: document repeated keys --- src/libexpr/primops.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 05265411c..3572ca181 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -2420,12 +2420,15 @@ static RegisterPrimOp primop_listToAttrs({ Construct a set from a list specifying the names and values of each attribute. Each element of the list should be a set consisting of a string-valued attribute `name` specifying the name of the attribute, - and an attribute `value` specifying its value. Example: + and an attribute `value` specifying its value. + In case of duplicate occurrences of the same name, the first + takes precedence. Example: ```nix builtins.listToAttrs [ { name = "foo"; value = 123; } { name = "bar"; value = 456; } + { name = "bar"; value = 420; } ] ``` From ec18b7d09b04f3bc4f4de81136fcb79a315bc829 Mon Sep 17 00:00:00 2001 From: Alex Ameen Date: Wed, 30 Nov 2022 23:21:09 -0600 Subject: [PATCH 2/3] doc: listToAttrs: fix line wrapping --- src/libexpr/primops.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 3572ca181..3e7fdf9d6 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -2420,9 +2420,8 @@ static RegisterPrimOp primop_listToAttrs({ Construct a set from a list specifying the names and values of each attribute. Each element of the list should be a set consisting of a string-valued attribute `name` specifying the name of the attribute, - and an attribute `value` specifying its value. - In case of duplicate occurrences of the same name, the first - takes precedence. Example: + and an attribute `value` specifying its value. In case of duplicate + occurrences of the same name, the first takes precedence. Example: ```nix builtins.listToAttrs From ef524013aad45aec846d27a7309cbfb1afdf54c4 Mon Sep 17 00:00:00 2001 From: Alex Ameen Date: Thu, 1 Dec 2022 10:32:45 -0600 Subject: [PATCH 3/3] doc: listToAttrs: add extra whitespace --- src/libexpr/primops.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 3e7fdf9d6..8a4c19f7c 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -2420,8 +2420,12 @@ static RegisterPrimOp primop_listToAttrs({ Construct a set from a list specifying the names and values of each attribute. Each element of the list should be a set consisting of a string-valued attribute `name` specifying the name of the attribute, - and an attribute `value` specifying its value. In case of duplicate - occurrences of the same name, the first takes precedence. Example: + and an attribute `value` specifying its value. + + In case of duplicate occurrences of the same name, the first + takes precedence. + + Example: ```nix builtins.listToAttrs