about summary refs log tree commit diff
path: root/tvix/eval/src/builtins
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-03-17T18·51+0300
committertazjin <tazjin@tvl.su>2023-03-17T19·17+0000
commitb78ae941a48bc7105ac964701a9e2c268b12d2ef (patch)
treeae4461992cbaecc7c8ee97adbac6e95b495e2dfa /tvix/eval/src/builtins
parent68d287fd82fb18d902d112417395501b33b66699 (diff)
fix(tvix/eval): use coerce_to_string in builtins.substring r/6022
This actually uses coercion under the hood in C++ Nix. See the test
for an example.

Change-Id: Id56b364acf269225b6829d0b600e0222f8b3608d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8322
Reviewed-by: andi <andi@notmuch.email>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/builtins')
-rw-r--r--tvix/eval/src/builtins/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index c56c53e46581..464809b270e0 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -835,7 +835,7 @@ mod pure_builtins {
     ) -> Result<Value, ErrorKind> {
         let beg = start.as_int()?;
         let len = len.as_int()?;
-        let x = s.to_str()?;
+        let x = s.coerce_to_string(co, CoercionKind::Weak).await?.to_str()?;
 
         if beg < 0 {
             return Err(ErrorKind::IndexOutOfBounds { index: beg });