feat(tvix/eval): implement generator-based Nix equality logic

Adds a `Value::neo_nix_eq` method (the `neo_` prefix will be dropped
when we flip over to the generator implementation of the VM) which
implements Nix equality semantics using async, generator-based
comparisons.

Instead of tracking the "kind" of equality that is being compared (see
the pointer-equality doc) through a pair of booleans, I've introduced
an enum that explicitly lists the possible comparisons.

Change-Id: I3354cc1470eeccb3000a5ae24f2418db1a7a2edc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8241
Tested-by: BuildkiteCI
Reviewed-by: Adam Joseph <adam@westernsemico.com>
This commit is contained in:
Vincent Ambo 2023-03-10 14:39:44 +03:00 committed by tazjin
parent cd447e1859
commit cbb4137dc0
2 changed files with 182 additions and 6 deletions

View file

@ -14,17 +14,13 @@ use smol_str::SmolStr;
use std::fmt::Display;
use std::future::Future;
use crate::value::SharedThunkSet;
use crate::value::{PointerEquality, SharedThunkSet};
use crate::warnings::WarningKind;
use crate::FileType;
use crate::NixString;
use super::*;
/// Dummy type, before the actual implementation is in place.
#[derive(Debug)]
pub struct PointerEquality {}
// -- Implementation of generic generator logic.
/// States that a generator can be in while being driven by the VM.