Merge pull request #7381 from aakropotkin/doc-ltoa-conflicts

doc: listToAttrs: document repeated keys
This commit is contained in:
Valentin Gagarin 2022-12-02 14:19:34 +01:00 committed by GitHub
commit 0ce5742bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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; }
]
```