aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Gagarin <valentin.gagarin@tweag.io>2022-12-02 14:19:34 +0100
committerGitHub <noreply@github.com>2022-12-02 14:19:34 +0100
commit0ce5742bec25d4316b58696c286e2bfed6588c94 (patch)
tree91b7c35bfb9cb4d02ff6379d97dd7bf95f2ef269
parentca42068bdc26108cfbd9f7db8af03730bc66d13a (diff)
parentef524013aad45aec846d27a7309cbfb1afdf54c4 (diff)
Merge pull request #7381 from aakropotkin/doc-ltoa-conflicts
doc: listToAttrs: document repeated keys
-rw-r--r--src/libexpr/primops.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 05265411c..8a4c19f7c 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -2420,12 +2420,18 @@ 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; }
]
```