fix(tvix/eval): catchable-aware builtins

A bunch of operations in Tvix are not aware of catchable values
and does not propagate them.

In the meantime, as we wait for a better solution, we just offer this
commit for moving the needle.

Change-Id: Ic3f0e1550126b0847b597dfc1402c35e0eeef469
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10473
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Ryan Lahfa 2023-12-30 03:21:45 +01:00 committed by raitobezarius
parent 37cc88897e
commit 2750e1e640
6 changed files with 328 additions and 41 deletions

View file

@ -34,7 +34,10 @@ impl Value {
let mut out = vec![];
for val in l.into_iter() {
out.push(generators::request_to_json(co, val).await);
match generators::request_to_json(co, val).await {
Ok(v) => out.push(v),
Err(cek) => return Ok(Err(cek)),
}
}
Json::Array(out)
@ -67,14 +70,17 @@ impl Value {
// serialise to a JSON serialisation of that inner
// value (regardless of what it is!).
if let Some(out_path) = attrs.select("outPath") {
return Ok(Ok(generators::request_to_json(co, out_path.clone()).await));
return Ok(generators::request_to_json(co, out_path.clone()).await);
}
let mut out = Map::with_capacity(attrs.len());
for (name, value) in attrs.into_iter_sorted() {
out.insert(
name.as_str().to_string(),
generators::request_to_json(co, value).await,
match generators::request_to_json(co, value).await {
Ok(v) => v,
Err(cek) => return Ok(Err(cek)),
},
);
}