lib/types: Fix coercedTo check

Without this change

  (coercedTo str toInt int).check "foo"

would evaluate to true, even though

  (coercedTo str toInt int).merge {} [{ value = "foo"; }]

will throw an error because "foo" can't be coerced to an int.
This commit is contained in:
Silvan Mosberger 2018-03-09 13:41:55 +01:00 committed by Profpatsch
parent 85b5fc7c98
commit ef8996f15e

View file

@ -420,7 +420,7 @@ rec {
mkOptionType rec {
name = "coercedTo";
description = "${finalType.description} or ${coercedType.description}";
check = x: finalType.check x || coercedType.check x;
check = x: finalType.check x || (coercedType.check x && finalType.check (coerceFunc x));
merge = loc: defs:
let
coerceVal = val: