lix/doc/manual/rl-next/with-error-reporting.md
eldritch horrors 6b279cd10e Merge pull request #9658 from pennae/env-diet
reduce the size of Env by one pointer

(cherry picked from commit 83f5622545a2fc31eb7e7d5105f64ed6dd3058b3)
Change-Id: I5636290526d0165cfc61aee1e7a5b94db4a26cef
2024-03-04 07:37:45 +01:00

796 B

synopsis prs
Better error reporting for `with` expressions 9658

with expressions using non-attrset values to resolve variables are now reported with proper positions.

Previously an incorrect with expression would report no position at all, making it hard to determine where the error originated:

nix-repl> with 1; a  
error:
       … <borked>

         at «none»:0: (source not available)

       error: value is an integer while a set was expected

Now position information is preserved and reported as with most other errors:

nix-repl> with 1; a
error:
       … while evaluating the first subexpression of a with expression
         at «string»:1:1:
            1| with 1; a
             | ^

       error: value is an integer while a set was expected