mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 20:16:03 +01:00
fetchTree: add pos to EvalState::forceValue
- This way we improve error messages
on infinite recursion
- Demo:
```nix
let x = builtins.fetchTree {
type = "git";
inherit 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:3:10:
2| type = "git";
3| inherit x;
| ^
4| };
```
Mentions: #3505
This commit is contained in:
parent
18e3d63341
commit
e5a27a3b4e
1 changed files with 1 additions and 1 deletions
|
|
@ -121,7 +121,7 @@ static void fetchTree(
|
|||
|
||||
for (auto & attr : *args[0]->attrs) {
|
||||
if (attr.name == state.sType) continue;
|
||||
state.forceValue(*attr.value);
|
||||
state.forceValue(*attr.value, *attr.pos);
|
||||
if (attr.value->type() == nPath || attr.value->type() == nString) {
|
||||
auto s = state.coerceToString(*attr.pos, *attr.value, context, false, false);
|
||||
attrs.emplace(attr.name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue