feat(tvix/eval): implement equality on derivations

Change-Id: I344b66c39cbc4b426accc482aa8f6f2eb18db68a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7417
Autosubmit: Adam Joseph <adam@westernsemico.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Adam Joseph 2022-11-25 14:50:07 -08:00 committed by clbot
parent 7606e62a2f
commit 580616a812

View file

@ -477,6 +477,38 @@ impl<'o> VM<'o> {
}
}
allow_pointer_equality_on_functions_and_thunks = true;
match (a1.select("type"), a2.select("type")) {
(Some(v1), Some(v2))
if "derivation"
== fallible!(
self,
v1.coerce_to_string(CoercionKind::ThunksOnly, self)
)
.as_str()
&& "derivation"
== fallible!(
self,
v2.coerce_to_string(CoercionKind::ThunksOnly, self)
)
.as_str() =>
{
if fallible!(
self,
a1.select("outPath")
.expect("encountered a derivation with no `outPath` attribute!")
.coerce_to_string(CoercionKind::ThunksOnly, self)
) == fallible!(
self,
a2.select("outPath")
.expect("encountered a derivation with no `outPath` attribute!")
.coerce_to_string(CoercionKind::ThunksOnly, self)
) {
continue;
}
break false;
}
_ => {}
}
let iter1 = unwrap_or_clone_rc(a1).into_iter_sorted();
let iter2 = unwrap_or_clone_rc(a2).into_iter_sorted();
if iter1.len() != iter2.len() {