Revert "lib/modules: Throw better error when definitions assign to an option set"

This reverts commit 15c873b486.

This was causing infinite recursion when depending on nested options
This commit is contained in:
Silvan Mosberger 2020-03-19 03:48:46 +01:00
parent d0cf54223c
commit 9eecf2d057
No known key found for this signature in database
GPG key ID: E8F1E9EAD284E17D
3 changed files with 1 additions and 9 deletions

View file

@ -299,9 +299,7 @@ rec {
in
throw "The option `${showOption loc}' in `${firstOption._file}' is a prefix of options in `${firstNonOption._file}'."
else
if all (def: isAttrs def.value) defns' then mergeModules' loc decls defns
else let firstInvalid = findFirst (def: ! isAttrs def.value) null defns';
in throw "The option path `${showOption loc}' is an attribute set of options, but it is defined to not be an attribute set in `${firstInvalid.file}'. Did you define its value at the correct and complete path?"
mergeModules' loc decls defns
))
// { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; };

View file

@ -199,9 +199,6 @@ checkConfigOutput "true" config.conditionalWorks ./declare-attrsOf.nix ./attrsOf
checkConfigOutput "false" config.conditionalWorks ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
checkConfigOutput "empty" config.value.foo ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
# Check error for when an option set is defined to be a non-attribute set value
checkConfigError 'The option path .* is an attribute set of options, but it is defined to not be an attribute set in' \
config.value ./declare-option-set.nix ./define-value-int-zero.nix
# Even with multiple assignments, a type error should be thrown if any of them aren't valid
checkConfigError 'The option value .* in .* is not of type .*' \

View file

@ -1,3 +0,0 @@
{
options.value = {};
}