forked from mirrors/nixpkgs
Improve types.listOf error message
If an option value is not a list, you now get The option value `bla' in `file.nix' is not a list. rather than value is a string while a list was expected, at .../nixpkgs/lib/lists.nix:49:56
This commit is contained in:
parent
32bed83b18
commit
b056948c00
|
@ -114,13 +114,17 @@ rec {
|
||||||
name = "list of ${elemType.name}s";
|
name = "list of ${elemType.name}s";
|
||||||
check = isList;
|
check = isList;
|
||||||
merge = loc: defs:
|
merge = loc: defs:
|
||||||
map (x: x.value) (filter (x: x ? value) (concatLists (imap (n: def: imap (m: def':
|
map (x: x.value) (filter (x: x ? value) (concatLists (imap (n: def:
|
||||||
(mergeDefinitions
|
if isList def.value then
|
||||||
(loc ++ ["[definition ${toString n}-entry ${toString m}]"])
|
imap (m: def':
|
||||||
elemType
|
(mergeDefinitions
|
||||||
[{ inherit (def) file; value = def'; }]
|
(loc ++ ["[definition ${toString n}-entry ${toString m}]"])
|
||||||
).optionalValue
|
elemType
|
||||||
) def.value) defs)));
|
[{ inherit (def) file; value = def'; }]
|
||||||
|
).optionalValue
|
||||||
|
) def.value
|
||||||
|
else
|
||||||
|
throw "The option value `${showOption loc}' in `${def.file}' is not a list.") defs)));
|
||||||
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]);
|
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]);
|
||||||
getSubModules = elemType.getSubModules;
|
getSubModules = elemType.getSubModules;
|
||||||
substSubModules = m: listOf (elemType.substSubModules m);
|
substSubModules = m: listOf (elemType.substSubModules m);
|
||||||
|
|
Loading…
Reference in a new issue