Fix "specific" match statement exiting early (#4492)
This commit is contained in:
parent
d2c59f0b71
commit
f8ba01a688
2 changed files with 6 additions and 2 deletions
|
@ -74,7 +74,7 @@ macro_rules! dispatch {
|
|||
$($wrapper)*(|| $($function_path)::+($($ctx_arg,)* args))()$(.$await)*
|
||||
},)+
|
||||
_ => {
|
||||
return Err($crate::err::Error::InvalidFunction{
|
||||
Err($crate::err::Error::InvalidFunction{
|
||||
name: String::from($name),
|
||||
message: $message.to_string()
|
||||
})
|
||||
|
|
|
@ -6237,6 +6237,9 @@ async fn function_idiom_chaining() -> Result<(), Error> {
|
|||
true.is_bool();
|
||||
true.doesnt_exist();
|
||||
field.bla.nested.is_none();
|
||||
// String is one of the types in the initial match statement,
|
||||
// this test ensures that the dispatch macro does not exit early
|
||||
"string".is_bool();
|
||||
"#;
|
||||
Test::new(sql)
|
||||
.await?
|
||||
|
@ -6245,6 +6248,7 @@ async fn function_idiom_chaining() -> Result<(), Error> {
|
|||
.expect_val("false")?
|
||||
.expect_val("true")?
|
||||
.expect_error("There was a problem running the doesnt_exist() function. no such method found for the bool type")?
|
||||
.expect_val("true")?;
|
||||
.expect_val("true")?
|
||||
.expect_val("false")?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue