tvix/eval: PointerEquality::ForbidAll doesn't seem to be forwarded correctly

#278
Opened by sterni at 2023-06-09T11·08+00

builtins.genericClosure (at r/6245) (incorrectly) uses PointerEquality::ForbidAll to check whether it should insert. This doesn't actually seem to be the case. While pointer equality is disabled for the top level:

let
  id = x: x;
in

builtins.genericClosure {
  startSet = [ { key = id; first = true; } ];
  operator =
    { first, ... }:
    if first then [
      { key = id; first = false; }
    ] else [];
}
# => [ { first = true; key = <LAMBDA>; } { first = false; key = <CYCLE>; } ] :: list

It doesn't seem to propagate through containers, e.g. if we use [ id ]:

let
  id = x: x;
in
builtins.genericClosure {
  startSet = [ { key = [ id ]; first = true; } ];
  operator =
    { first, ... }:
    if first then [
      { key = [ id ]; first = false; }
    ] else [];
}
# => [ { first = true; key = [ <LAMBDA> ]; } ] :: list

Note that the behavior of builtins.genericClosure should be different entirely, but this is something we'll be able to tackle using the test cases in cl/8700. Investigating this has lead me to this different than advertised behavior.