tvix/eval: Legacy let inside a with block panics with "attempt to subtract with overflow

#203
Opened by aspen at 2022-10-08T18·41+00

❯ cargo r
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/tvix-eval`
tvix-repl> with { x = 1; }; let { y = x; body = y; }
warning[W005]: legacy `let` syntax used, please rewrite this as `let .. in ...`
 --> [tvix-repl]:1:18
  |
1 | with { x = 1; }; let { y = x; body = y; }
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^

warning[W003]: variable 'body' is declared, but never used:
 --> [tvix-repl]:1:31
  |
1 | with { x = 1; }; let { y = x; body = y; }
  |                               ^^^^ variable declared here

thread 'main' panicked at 'attempt to subtract with overflow', src/vm.rs:492:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  1. grfn updated the body of this issue at 2022-10-08T18·42+00
  2. Note that

    with {}; let { body = 1; }

    fails but

    with {}; (rec { body = 1; }).body

    works, which should be the desugaring of the former.

    That indicates the desugaring is incorrect right now.

    tazjin at 2022-10-08T19·03+00

  3. Fixed in cl/6898

    tazjin at 2022-10-08T19·09+00

  4. tazjin closed this issue at 2022-10-08T19·11+00