Tvix-repl: Acessing NativeError errors twice in a row causes infinite recursion.

#422
Opened by hsjobeki at 2024-10-27T16·38+00

I didn't check all the other error cases.

This causes NativeError because throw expects a string; but gets called with int.

tvix-repl> a = { a = throw 1; }
tvix-repl> a.a
note: while evaluating this Nix code
 --> [code]:1:1
  |
1 | a.a
  | ^^^
note: while evaluating this as native code (force)
 --> [code]:1:7
  |
1 | { a = throw 1; }
  |       ^^^^^^^
error[E006]: expected value of type 'contextful string', but found a 'int'
 --> [code]:1:7
  |
1 | { a = throw 1; }
  |       ^^^^^^^

tvix-repl> a.a
note: while evaluating this Nix code
 --> [code]:1:1
  |
1 | a.a
  | ^^^
error[E014]: infinite recursion encountered
 --> [code]:1:1
  |
1 | { a = throw 1; }
  | ^^^   -------
  | |     |     |
  | |     |     this lazily-evaluated code
  | |     which was instantiated here
  | was first requested to be evaluated here
  | but then requested again here during its own evaluation

tvix-repl> 

  1. hsjobeki updated the body of this issue at 2024-10-27T16·38+00
  2. hsjobeki changed the subject of this issue from "Tvix-repl: Double acessing NativeError errors causes infinite recursion." to "Tvix-repl: Acessing NativeError errors twice in a row causes infinite recursion. " at 2024-10-27T16·39+00