lib/types: Improved functionTo merging

Now type checks the resulting function values and allows mkMerge and co.
Also indicates that the type check is done in the function body

Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
This commit is contained in:
Silvan Mosberger 2021-01-26 02:02:12 +01:00
parent 8ac4b251c8
commit e9101d4a3b
No known key found for this signature in database
GPG key ID: E8F1E9EAD284E17D

View file

@ -457,7 +457,7 @@ rec {
name = "function that evaluates to a(n) ${elemType.name}";
check = isFunction;
merge = loc: defs:
fnArgs: elemType.merge loc (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs);
fnArgs: (mergeDefinitions (loc ++ [ "[function body]" ]) elemType (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs)).mergedValue;
getSubOptions = elemType.getSubOptions;
getSubModules = elemType.getSubModules;
substSubModules = m: functionTo (elemType.substSubModules m);