mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
lib.types.anything: remove custom logic for lists (#340202)
This commit is contained in:
commit
d572d95502
@ -429,8 +429,8 @@ checkConfigOutput '^null$' config.value.l1.l2.foo ./types-anything/nested-attrs.
|
||||
checkConfigOutput '^null$' config.value.l1.l2.l3.foo ./types-anything/nested-attrs.nix
|
||||
# Attribute sets that are coercible to strings shouldn't be recursed into
|
||||
checkConfigOutput '^"foo"$' config.value.outPath ./types-anything/attrs-coercible.nix
|
||||
# Multiple lists aren't concatenated together
|
||||
checkConfigError 'The option .* has conflicting definitions' config.value ./types-anything/lists.nix
|
||||
# Multiple lists aren't concatenated together if their definitions are not equal
|
||||
checkConfigError 'The option .* has conflicting definition values' config.value ./types-anything/lists.nix
|
||||
# Check that all equalizable atoms can be used as long as all definitions are equal
|
||||
checkConfigOutput '^0$' config.value.int ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^false$' config.value.bool ./types-anything/equal-atoms.nix
|
||||
@ -438,6 +438,7 @@ checkConfigOutput '^""$' config.value.string ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^"/[^"]+"$' config.value.path ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^null$' config.value.null ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^0.1$' config.value.float ./types-anything/equal-atoms.nix
|
||||
checkConfigOutput '^\[1,"a",{"x":null}\]$' config.value.list ./types-anything/equal-atoms.nix
|
||||
# Functions can't be merged together
|
||||
checkConfigError "The option .value.multiple-lambdas.<function body>. has conflicting option types" config.applied.multiple-lambdas ./types-anything/functions.nix
|
||||
checkConfigOutput '^true$' config.valueIsFunction.single-lambda ./types-anything/functions.nix
|
||||
|
@ -12,6 +12,7 @@
|
||||
value.path = ./.;
|
||||
value.null = null;
|
||||
value.float = 0.1;
|
||||
value.list = [1 "a" {x=null;}];
|
||||
}
|
||||
{
|
||||
value.int = 0;
|
||||
@ -20,6 +21,7 @@
|
||||
value.path = ./.;
|
||||
value.null = null;
|
||||
value.float = 0.1;
|
||||
value.list = [1 "a" {x=null;}];
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
value = [ null ];
|
||||
value = [ "a value" ];
|
||||
}
|
||||
{
|
||||
value = [ null ];
|
||||
value = [ "another value" ];
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -253,12 +253,6 @@ rec {
|
||||
mergeFunction = {
|
||||
# Recursively merge attribute sets
|
||||
set = (attrsOf anything).merge;
|
||||
# Safe and deterministic behavior for lists is to only accept one definition
|
||||
# listOf only used to apply mkIf and co.
|
||||
list =
|
||||
if length defs > 1
|
||||
then throw "The option `${showOption loc}' has conflicting definitions, in ${showFiles (getFiles defs)}."
|
||||
else (listOf anything).merge;
|
||||
# This is the type of packages, only accept a single definition
|
||||
stringCoercibleSet = mergeOneOption;
|
||||
lambda = loc: defs: arg: anything.merge
|
||||
|
Loading…
Reference in New Issue
Block a user