Skip to content

Commit

Permalink
Improve error reporting on fresh rhs
Browse files Browse the repository at this point in the history
- Accidential array merge functions that are also fresh leaves in the
  data spine now throw an error.
  • Loading branch information
blaggacao committed Nov 3, 2021
1 parent 474edc1 commit 68bd71f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@
rhsPos = builtins.unsafeGetAttrPos n (getAttrFromPath attrPath rhs);
in "${rhsPos.file}:${toString rhsPos.line}:${toString rhsPos.column}";
in
if isSingleton then head values
if (isSingleton && isFunction (head values)) then abort ''
a fresh right-hand-side cannot be an array merge function
at '${concatStringsSep "." here'}':
- rhs: ${typeOf rhs'} @ ${rhsFilePos}
''
else if isSingleton then head values
else if !(isAttrs lhs' && isAttrs rhs')
then
if (typeOf lhs') != (typeOf rhs') && !(isList lhs' && isFunction rhs')
Expand Down

0 comments on commit 68bd71f

Please sign in to comment.