mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
lib/options: Better mergeEqualOption error for uncomparable types
For an option definition that uses `lib.options.mergeEqualOption` underneath, like `types.anything`, an error is thrown when multiple functions are assigned, indicating that functions can't be compared for equivalence: error: The option `test' has conflicting definition values: - In `xxx': <function> - In `xxx': <function> (use '--show-trace' to show detailed location information) However, the error message didn't use the correct files. While above error indicates that both definitions are in the xxx file, that's in fact not true. Above error was generated with options.test = lib.mkOption { type = lib.types.anything; }; imports = [ { _file = "yyy"; test = y: y; } { _file = "xxx"; test = x: x; } ]; With this change, the error uses the correct file locations: error: The option `test' has conflicting definition values: - In `xxx': <function> - In `yyy': <function> (use '--show-trace' to show detailed location information)
This commit is contained in:
parent
ebc72941f0
commit
998a9c1707
1 changed files with 2 additions and 1 deletions
|
@ -11,6 +11,7 @@ let
|
|||
filter
|
||||
foldl'
|
||||
head
|
||||
tail
|
||||
isAttrs
|
||||
isBool
|
||||
isDerivation
|
||||
|
@ -144,7 +145,7 @@ rec {
|
|||
if def.value != first.value then
|
||||
throw "The option `${showOption loc}' has conflicting definition values:${showDefs [ first def ]}"
|
||||
else
|
||||
first) (head defs) defs).value;
|
||||
first) (head defs) (tail defs)).value;
|
||||
|
||||
/* Extracts values of all "value" keys of the given list.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue