fix(tvix/eval): propagate catchables in string interpolations
Change-Id: I13d7ce0c7328a8e6fbc6d2c4ff5c4fe6095b96ea Reviewed-on: https://cl.tvl.fyi/c/depot/+/10357 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
7ddea7340f
commit
2883b2d4bd
3 changed files with 12 additions and 2 deletions
|
@ -0,0 +1 @@
|
|||
false
|
|
@ -0,0 +1 @@
|
|||
(builtins.tryEval ("${toString 3} ${throw "bob"}")).success
|
|
@ -983,8 +983,16 @@ impl<'o> VM<'o> {
|
|||
fn run_interpolate(&mut self, frame: &CallFrame, count: usize) -> EvalResult<()> {
|
||||
let mut out = String::new();
|
||||
|
||||
for _ in 0..count {
|
||||
out.push_str(self.stack_pop().to_str().with_span(frame, self)?.as_str());
|
||||
for i in 0..count {
|
||||
let val = self.stack_pop();
|
||||
if val.is_catchable() {
|
||||
for _ in (i + 1)..count {
|
||||
self.stack.pop();
|
||||
}
|
||||
self.stack.push(val);
|
||||
return Ok(());
|
||||
}
|
||||
out.push_str(val.to_str().with_span(frame, self)?.as_str());
|
||||
}
|
||||
|
||||
self.stack.push(Value::String(out.into()));
|
||||
|
|
Loading…
Reference in a new issue