anchor.diff:            # paths, meaning recursiveUpdate will never override any value
             else recursiveUpdate freeformConfig declaredConfig;
   
  +      /*
  +      Inject a list of assertions into a config value, corresponding to their
  +      triggerPath (meaning when that path is accessed from the result of this
  +      function, the assertion triggers).
  +      */
  +      injectAssertions = assertions: config: let
  +        # Partition into assertions that are triggered on this level and ones that aren't
  +        parted = partition (a: length a.triggerPath == 0) assertions;
  +
  +        # From the ones that are triggered, filter out ones that aren't enabled
  +        # and group into warnings/errors
  +        byType = groupBy (a: a.type) (filter (a: a.enable) parted.right);
  +
  +        # Triggers semantically are just lib.id, but they print warning cause errors in addition
  +        warningTrigger = value: lib.foldr (w: warn w.show) value (byType.warning or []);
  +        errorTrigger = value:
  +          if byType.error or [] == [] then value else
  +          throw ''
  +            Failed assertions:
  +            ${concatMapStringsSep "\n" (a: "- ${a.show}") byType.error}
  +          '';
  +        # Trigger for both warnings and errors
  +        trigger = value: warningTrigger (errorTrigger value);
  +
  +        # From the non-triggered assertions, split off the first element of triggerPath
  +        # to get a mapping from nested attributes to a list of assertions for that attribute
  +        nested = zipAttrs (map (a: {
  +          ${head a.triggerPath} = a // {
  +            triggerPath = tail a.triggerPath;
  +          };
  +        }) parted.wrong);
  +
  +        # Recursively inject assertions if config is an attribute set and we
  +        # have assertions under its attributes
  +        result =
  +          if isAttrs config
  +          then
  +            mapAttrs (name: value:
  +              if nested ? ${name}
  +              then injectAssertions nested.${name} value
  +              else value
  +            ) config
  +          else config;
  +      in trigger result;
  +
  +      # List of assertions for this module evaluation, where each assertion also
  +      # has a `show` attribute for how to show it if triggered
  +      assertions = mapAttrsToList (name: value:
  +        let id =
  +          if hasPrefix "_" name then ""
  +          else "[${showOption prefix}${optionalString (prefix != []) "/"}${name}] ";
  +        in value // {
  +          show = "${id}${value.message}";
  +        }
  +      ) config._module.assertions;
  +
  +      finalConfig = injectAssertions assertions (removeAttrs config [ "_module" ]);
  +
         checkUnmatched =
           if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             let
  
positive.code:               turned off.
              '';
            };
          };
  
          config = {
  
negative.code: 
        result = builtins.seq checkUnmatched {
          inherit options;
          config = finalConfig;
          inherit (config) _module;
        };
      in result;
  