lib/types: clear up coercedTo description
This commit is contained in:
parent
b16a69289a
commit
cd5736116c
|
@ -136,11 +136,11 @@ checkConfigOutput "true" "$@" ./define-module-check.nix
|
||||||
# Check coerced value.
|
# Check coerced value.
|
||||||
checkConfigOutput "\"42\"" config.value ./declare-coerced-value.nix
|
checkConfigOutput "\"42\"" config.value ./declare-coerced-value.nix
|
||||||
checkConfigOutput "\"24\"" config.value ./declare-coerced-value.nix ./define-value-string.nix
|
checkConfigOutput "\"24\"" config.value ./declare-coerced-value.nix ./define-value-string.nix
|
||||||
checkConfigError 'The option value .* in .* is not.*string or signed integer.*' config.value ./declare-coerced-value.nix ./define-value-list.nix
|
checkConfigError 'The option value .* in .* is not.*string or signed integer convertible to it' config.value ./declare-coerced-value.nix ./define-value-list.nix
|
||||||
|
|
||||||
# Check coerced value with unsound coercion
|
# Check coerced value with unsound coercion
|
||||||
checkConfigOutput "12" config.value ./declare-coerced-value-unsound.nix
|
checkConfigOutput "12" config.value ./declare-coerced-value-unsound.nix
|
||||||
checkConfigError 'The option value .* in .* is not.*8 bit signed integer.* or string.*' config.value ./declare-coerced-value-unsound.nix ./define-value-string-bigint.nix
|
checkConfigError 'The option value .* in .* is not.*8 bit signed integer.* or string convertible to it' config.value ./declare-coerced-value-unsound.nix ./define-value-string-bigint.nix
|
||||||
checkConfigError 'unrecognised JSON value' config.value ./declare-coerced-value-unsound.nix ./define-value-string-arbitrary.nix
|
checkConfigError 'unrecognised JSON value' config.value ./declare-coerced-value-unsound.nix ./define-value-string-arbitrary.nix
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
|
@ -256,7 +256,7 @@ rec {
|
||||||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||||
};
|
};
|
||||||
|
|
||||||
nonEmptyListOf = elemType:
|
nonEmptyListOf = elemType:
|
||||||
let list = addCheck (types.listOf elemType) (l: l != []);
|
let list = addCheck (types.listOf elemType) (l: l != []);
|
||||||
in list // { description = "non-empty " + list.description; };
|
in list // { description = "non-empty " + list.description; };
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ rec {
|
||||||
assert coercedType.getSubModules == null;
|
assert coercedType.getSubModules == null;
|
||||||
mkOptionType rec {
|
mkOptionType rec {
|
||||||
name = "coercedTo";
|
name = "coercedTo";
|
||||||
description = "${finalType.description} or ${coercedType.description}";
|
description = "${finalType.description} or ${coercedType.description} convertible to it";
|
||||||
check = x: finalType.check x || (coercedType.check x && finalType.check (coerceFunc x));
|
check = x: finalType.check x || (coercedType.check x && finalType.check (coerceFunc x));
|
||||||
merge = loc: defs:
|
merge = loc: defs:
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in New Issue