eval
eval copied to clipboard
Incorrect evaluation order when using data-like access
Evaluation order seems to be wrong when the dot operator is used.
#[test]
fn test_operator_precedence() {
// Show that operator precedence is working as expected.
assert_eq!(eval(r#""a" == "a" && "b" == "b""#), Ok(to_value(true)));
let mut v = HashMap::new();
v.insert("a", "1");
v.insert("b", "2");
// This is returning the expected result if we put the comparisons between parentheses.
assert_eq!(Expr::new("(v.a == v.a) && (v.b == v.b)").value("v", v.clone()).exec(),
Ok(to_value(true)));
// This should return the same result as the previous Expr, but it is instead
// returning Err(UnsupportedTypes("String(\"1\")", "Bool(true)")).
assert_eq!(Expr::new("v.a == v.a && v.b == v.b").value("v", v).exec(),
Ok(to_value(true)));
}
Sorry guys. I have no time and interest in Rust right now. This project is going to Abandoned status.