fix(tvix/eval): Propagate catchables in a few more places

Propagate catchables that we get from forcing thunks in builtins in a
few more places using the new try_value! macro

Change-Id: I95fd41a231f877ff153f4adbabd944372d4cc7eb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10738
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
This commit is contained in:
Aspen Smith 2024-02-02 15:49:52 -05:00 committed by aspen
parent 780b47193a
commit b77a103a2a

View file

@ -249,7 +249,7 @@ mod pure_builtins {
let mut out = imbl::Vector::new();
for value in lists.to_list()? {
let list = generators::request_force(&co, value).await.to_list()?;
let list = try_value!(generators::request_force(&co, value).await).to_list()?;
out.extend(list.into_iter());
}
@ -262,7 +262,7 @@ mod pure_builtins {
let mut res = imbl::Vector::new();
for val in list {
let out = generators::request_call_with(&co, f.clone(), [val]).await;
let out = generators::request_force(&co, out).await;
let out = try_value!(generators::request_force(&co, out).await);
res.extend(out.to_list()?);
}
Ok(Value::List(res.into()))
@ -898,9 +898,10 @@ mod pure_builtins {
let list = list.to_list()?;
let mut map = BTreeMap::new();
for val in list {
let attrs = generators::request_force(&co, val).await.to_attrs()?;
let name = generators::request_force(&co, attrs.select_required("name")?.clone())
.await
let attrs = try_value!(generators::request_force(&co, val).await).to_attrs()?;
let name = try_value!(
generators::request_force(&co, attrs.select_required("name")?.clone()).await
)
.to_str()?;
let value = attrs.select_required("value")?.clone();
// Map entries earlier in the list take precedence over entries later in the list
@ -1023,7 +1024,7 @@ mod pure_builtins {
for elem in list {
let result = generators::request_call_with(&co, pred.clone(), [elem.clone()]).await;
if generators::request_force(&co, result).await.as_bool()? {
if try_value!(generators::request_force(&co, result).await).as_bool()? {
right.push_back(elem);
} else {
wrong.push_back(elem);
@ -1069,12 +1070,12 @@ mod pure_builtins {
) -> Result<Value, ErrorKind> {
let from = from.to_list()?;
for val in &from {
generators::request_force(&co, val.clone()).await;
try_value!(generators::request_force(&co, val.clone()).await);
}
let to = to.to_list()?;
for val in &to {
generators::request_force(&co, val.clone()).await;
try_value!(generators::request_force(&co, val.clone()).await);
}
let mut string = s.to_contextful_str()?;