Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not return false/true when one of the children's expressions returns false/true in AND/OR directly in with the conjunction simplification rule #440

Open
unconsolable opened this issue Aug 25, 2024 · 0 comments
Labels
question Further information is requested

Comments

@unconsolable
Copy link

Question

if (conjunction_expr->conjunction_type() == ConjunctionExpr::Type::AND) {
if (constant_value == true) {
child_exprs.erase(iter);
} else {
// always be false
std::unique_ptr<Expression> child_expr = std::move(child_exprs.front());
child_exprs.clear();
expr = std::move(child_expr);
return rc;
}
} else {
// conjunction_type == OR
if (constant_value == true) {
// always be true
std::unique_ptr<Expression> child_expr = std::move(child_exprs.front());
child_exprs.clear();
expr = std::move(child_expr);
return rc;
} else {
child_exprs.erase(iter);
}
}
}

I wonder when one of the children in the AND conjunction expression returns false, this code snippet does not return false directly. Instead, it returns the first child expression (L57-L60). A similar case for the OR conjunction expression (L66-L69).

Thank you.

@unconsolable unconsolable added the question Further information is requested label Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant