about summary refs log tree commit diff
path: root/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-genericClosure-pointer-equality.nix
blob: f6ca340c096a73379567985d1ee1ba1a759ec46a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
let
  foo = x: x;
in

# key needs to be a list since it uses comparison, not equality checks:
  # lists are comparable in Nix if all non-comparable items in them are equal (e.g.
  # functions, attribute sets).
builtins.genericClosure {
  startSet = [
    { key = [{ inherit foo; }]; val = null; }
  ];
  operator = { val, ... }: if val != null then [ ] else [
    { key = [{ inherit foo; }]; val = throw "no pointer equality? 🥺👉👈"; }
  ];
}