No assert, but return when regex haystack is not Str

This commit is contained in:
Paul Masurel
2026-09-09 15:24:19 +02:00
parent ffaaa1cad3
commit fdc9cb2a14
+1 -3
View File
@@ -95,11 +95,9 @@ impl FnCall for RegexpExtractFnCall {
) -> Result<TypedExpr, CompileError> {
Self::ARG_COUNT.validate(args)?;
let haystack = context.apply_types(&args[0], target_type_set)?;
if haystack.return_type == VarType::None {
if haystack.return_type != VarType::Str {
return Ok(TypedExpr::none());
}
assert_eq!(haystack.return_type, VarType::Str);
let UntypedExpr::Literal(Literal::String(pattern)) = &args[1] else {
return Err(InvalidFunctionCall::ExpectedLiteral {
argument: 2,