@ -323,16 +323,14 @@ rec {
else
mergeDefinitions loc opt . type defs' ;
# Check whether the option is defined, and apply the ‘apply’
# function to the merged value. This allows options to yield a
# value computed from the definitions.
value =
if ! res . isDefined then
throw " T h e o p t i o n ` ${ showOption loc } ' i s u s e d b u t n o t d e f i n e d . "
else if opt ? apply then
opt . apply res . mergedValue
else
res . mergedValue ;
# The value with a check that it is defined
valueDefined = if res . isDefined then res . mergedValue else
throw " T h e o p t i o n ` ${ showOption loc } ' i s u s e d b u t n o t d e f i n e d . " ;
# Apply the 'apply' function to the merged value. This allows options to
# yield a value computed from the definitions
value = if opt ? apply then opt . apply valueDefined else valueDefined ;
in opt //
{ value = builtins . addErrorContext " w h i l e e v a l u a t i n g t h e o p t i o n ` ${ showOption loc } ' : " value ;