From 68bd71f980f75cf73bc5071982eddfe6bc089768 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Wed, 3 Nov 2021 14:29:04 -0500 Subject: [PATCH] Improve error reporting on fresh rhs - Accidential array merge functions that are also fresh leaves in the data spine now throw an error. --- flake.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 160e60a..9648d22 100644 --- a/flake.nix +++ b/flake.nix @@ -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')