test(tvix/eval): add eval-okay-closure-pointer-compare

This test case checks two things:

* A sanity check that "pointer equality for functions" means not
  just the lambda, but also the upvalues.

* To be pointer-equal, it is not enough for the upvalues to be
  normal-form equal (i.e. `nix_eq()`-equal); the upvalues must be
  *pointer*-equal.  The second part of the test case checks for
  this.

Signed-off-by: Adam Joseph <adam@westernsemico.com>
Change-Id: I4e59327a6f199b8212e97197b212e3c3934bb3f0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7372
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Adam Joseph 2022-11-23 22:25:32 -08:00 committed by clbot
parent 11874d3a71
commit 325a7d6fa9
2 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1 @@
[ false false ]

View file

@ -0,0 +1,14 @@
# For an explanation of this behavior see //tvix/docs/value-pointer-equality.md
let
g = x:
owo: "th" + x;
in
[
(
{ q = g "ia"; } == { q = g ("i"+"a"); }
)
(
[ (g "ia") ] == [ (g ("i"+"a")) ]
)
]