diff options
author | Kevin Amado <kamadorueda@gmail.com> | 2021-10-15 18:56:17 -0500 |
---|---|---|
committer | Kevin Amado <kamadorueda@gmail.com> | 2021-10-15 19:25:19 -0500 |
commit | 18e3d63341bc03e152659a6836a1b52a1241fe57 (patch) | |
tree | cf5a0cc86ffe39706c7cf821c6caf0c0ae54bcac /src/libexpr | |
parent | 130284b8508dad3c70e8160b15f3d62042fc730a (diff) |
fetchTree: add pos to EvalState::forceValue
- This way we improve error messages
on infinite recursion
- Demo:
```nix
let x = builtins.fetchTree x;
in x
```
- Before:
```bash
$ nix-instantiate --extra-experimental-features flakes --strict
error: infinite recursion encountered
```
- After:
```bash
$ nix-instantiate --extra-experimental-features flakes --strict
error: infinite recursion encountered
at /data/github/kamadorueda/nix/test.nix:1:9:
1| let x = builtins.fetchTree x;
| ^
2| in x
```
Mentions: #3505
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/primops/fetchTree.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index f570f19ae..441edd648 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -97,7 +97,7 @@ static void fetchTree( fetchers::Input input; PathSet context; - state.forceValue(*args[0]); + state.forceValue(*args[0], pos); if (args[0]->type() == nAttrs) { state.forceAttrs(*args[0], pos); |