libexpr/eval: Fix off by one in maxCallDepth calculation
This isn't really relevant for a setting of 10k, but now that we want to set it to 0 for Flakes it makes a difference as to whether or not one top-level function call is allowed or not. (It shouldn't be) Change-Id: I6bbf99826af0289c232b9d45d172a378b81abe4b
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
error: stack overflow; max-call-depth exceeded
|
||||
at /pwd/in.nix:2:22:
|
||||
1| # Exactly two function calls deep, so should fail with maxCallDepth < 2
|
||||
2| let f = x: x + 1; in f (f 0)
|
||||
| ^
|
||||
3|
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
error:
|
||||
… from call site
|
||||
at /pwd/in.nix:2:22:
|
||||
1| # Exactly two function calls deep, so should fail with maxCallDepth < 2
|
||||
2| let f = x: x + 1; in f (f 0)
|
||||
| ^
|
||||
3|
|
||||
|
||||
… while calling 'f'
|
||||
at /pwd/in.nix:2:9:
|
||||
1| # Exactly two function calls deep, so should fail with maxCallDepth < 2
|
||||
2| let f = x: x + 1; in f (f 0)
|
||||
| ^
|
||||
3|
|
||||
|
||||
… while evaluating x
|
||||
at /pwd/in.nix:2:12:
|
||||
1| # Exactly two function calls deep, so should fail with maxCallDepth < 2
|
||||
2| let f = x: x + 1; in f (f 0)
|
||||
| ^
|
||||
3|
|
||||
|
||||
error: stack overflow; max-call-depth exceeded
|
||||
at /pwd/in.nix:2:25:
|
||||
1| # Exactly two function calls deep, so should fail with maxCallDepth < 2
|
||||
2| let f = x: x + 1; in f (f 0)
|
||||
| ^
|
||||
3|
|
||||
@@ -29,7 +29,7 @@ error:
|
||||
| ^
|
||||
2|
|
||||
|
||||
(19997 duplicate frames omitted)
|
||||
(19995 duplicate frames omitted)
|
||||
|
||||
error: stack overflow; max-call-depth exceeded
|
||||
at /pwd/in.nix:1:14:
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
2
|
||||
@@ -0,0 +1,2 @@
|
||||
# Exactly two function calls deep, so should fail with maxCallDepth < 2
|
||||
let f = x: x + 1; in f (f 0)
|
||||
@@ -0,0 +1,21 @@
|
||||
[[test]]
|
||||
runner = "eval-fail"
|
||||
in = ["in-infrec.nix", "in-mutrec.nix"]
|
||||
matrix = true
|
||||
|
||||
[[test]]
|
||||
runner = "eval-okay"
|
||||
in = "in-maxCallDepth.nix"
|
||||
flags = ["--option", "max-call-depth", "2"]
|
||||
|
||||
[[test]]
|
||||
name = "evail-fail-maxCallDepth1"
|
||||
runner = "eval-fail"
|
||||
in = "in-maxCallDepth.nix"
|
||||
flags = ["--option", "max-call-depth", "1"]
|
||||
|
||||
[[test]]
|
||||
name = "evail-fail-maxCallDepth0"
|
||||
runner = "eval-fail"
|
||||
in = "in-maxCallDepth.nix"
|
||||
flags = ["--option", "max-call-depth", "0"]
|
||||
Reference in New Issue
Block a user