feat(tvix/eval): contextful string coercion

String with contexts are always coerced to a string with the same
context.

Change-Id: I224814febd9cad196bb28876793e76bed564dc72
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10440
Tested-by: BuildkiteCI
Autosubmit: raitobezarius <tvl@lahfa.xyz>
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Ryan Lahfa 2023-12-26 03:53:08 +01:00 committed by clbot
parent 9d43c26576
commit 951854defc

View file

@ -604,7 +604,7 @@ pub async fn request_string_coerce(
_ => match co.yield_(VMRequest::StringCoerce(val, kind)).await { _ => match co.yield_(VMRequest::StringCoerce(val, kind)).await {
VMResponse::Value(Value::Catchable(c)) => Err(c), VMResponse::Value(Value::Catchable(c)) => Err(c),
VMResponse::Value(value) => Ok(value VMResponse::Value(value) => Ok(value
.to_str() .to_contextful_str()
.expect("coerce_to_string always returns a string")), .expect("coerce_to_string always returns a string")),
msg => panic!( msg => panic!(
"Tvix bug: VM responded with incorrect generator message: {}", "Tvix bug: VM responded with incorrect generator message: {}",