diff options
Diffstat (limited to 'tvix/eval/src/builtins')
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 6cdb434f42b4..7cc2732ecfd9 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -766,8 +766,16 @@ mod pure_builtins { #[builtin("match")] async fn builtin_match(co: GenCo, regex: Value, str: Value) -> Result<Value, ErrorKind> { - let s = str.to_str()?; - let re = regex.to_str()?; + let s = str; + if s.is_catchable() { + return Ok(s); + } + let s = s.to_str()?; + let re = regex; + if re.is_catchable() { + return Ok(re); + } + let re = re.to_str()?; let re: Regex = Regex::new(&format!("^{}$", re.as_str())).unwrap(); match re.captures(&s) { Some(caps) => Ok(Value::List( |