diff options
author | sterni <sternenseemann@systemli.org> | 2023-06-02T21·05+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-06-07T15·19+0000 |
commit | a2303da01fb6de2e081ab93bf3944e8fcc1476a7 (patch) | |
tree | 99d3a4246b18e3518789845afe365106aef98447 /tvix/eval/src | |
parent | 10c6cb7251480ca12e67b3d237740e6dcb93f87e (diff) |
fix(tvix/eval): use normal thunking behavior for default in formals r/6244
When comparing to C++ Nix, we notice that the thunking of default expressions in function formals corresponds to their normal thunking, e.g. literals are not thunked. This means that we can just invoke compile() without much of a care and trust that it will sort it out correctly. If function formals blow up as a result of this, it likely indicates that the expression is treated incorrectly by compile(), not compile_param_pattern(). Change-Id: I64acbff2f251423eb72ce43e56a0603379305e1d Reviewed-on: https://cl.tvl.fyi/c/depot/+/8704 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src')
-rw-r--r-- | tvix/eval/src/compiler/mod.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index 450799d683d1..43dab506c5ed 100644 --- a/tvix/eval/src/compiler/mod.rs +++ b/tvix/eval/src/compiler/mod.rs @@ -950,15 +950,8 @@ impl Compiler<'_> { self.patch_jump(jump_to_default); - // Thunk the default expression, but only if it is something - // other than an identifier. - if let ast::Expr::Ident(_) = &default_expr { - self.compile(*idx, default_expr); - } else { - self.thunk(*idx, &self.span_for(&default_expr), move |c, s| { - c.compile(s, default_expr) - }); - } + // Does not need to thunked since compile() already does so when necessary + self.compile(*idx, default_expr); self.patch_jump(jump_over_default); } else { |