diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 31dc27969cc0..de88763854d6 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -627,11 +627,14 @@ rec { `y`, and all values `assert` with an error message. This operator is commutative, unlike (//). */ unionOfDisjoint = x: y: - x // (mapAttrs - (name: val: - if hasAttr name x - then builtins.throw "attribute collision: ${name}" - else val) y); + let + intersection = builtins.intersectAttrs x y; + collisions = lib.concatStringsSep " " (builtins.attrNames intersection); + mask = builtins.mapAttrs (name: value: builtins.throw + "unionOfDisjoint: collision on ${name}; complete list: ${collisions}") + intersection; + in + (x // y) // mask; /*** deprecated stuff ***/