lib/modules: add nested 'headError.message'

This should make headError extensible other information needs to be passed
This seems to improve performance slightly
This commit is contained in:
Johannes Kirschbauer 2025-06-06 17:44:53 +02:00
commit 50bef19448
No known key found for this signature in database
2 changed files with 6 additions and 4 deletions

View file

@ -104,7 +104,7 @@ let
let
invalidDefs = filter (def: !check def.value) defs;
in
if invalidDefs != [ ] then "Definition values: ${showDefs invalidDefs}" else null;
if invalidDefs != [ ] then { message = "Definition values: ${showDefs invalidDefs}"; } else null;
outer_types = rec {
isType = type: x: (x._type or "") == type;
@ -1450,8 +1450,10 @@ let
valueMeta = {
inherit headError;
};
headError = "The option `${showOption loc}` is neither a value of type `${t1.description}` nor `${t2.description}`, Definition values: ${showDefs defs}";
value = null;
headError = {
message = "The option `${showOption loc}` is neither a value of type `${t1.description}` nor `${t2.description}`, Definition values: ${showDefs defs}";
};
value = abort "(t.merge.v2 defs).value must only be accessed when `.headError == null`. This is a bug in code that consumes a module system type.";
};
in
checkedAndMerged;