Skip to content

Commit f3bf107

Browse files
author
Daniel Kroening
committed
improved typing in simplify_boolean
This improves type safety.
1 parent 27b0fda commit f3bf107

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/util/simplify_expr_boolean.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ simplify_exprt::resultt<> simplify_exprt::simplify_boolean(const exprt &expr)
2727

2828
if(expr.id()==ID_implies)
2929
{
30-
if(
31-
expr.operands().size() != 2 ||
32-
expr.operands().front().type().id() != ID_bool ||
33-
expr.operands().back().type().id() != ID_bool)
30+
const auto &implies_expr = to_implies_expr(expr);
31+
32+
if(implies_expr.op0().type().id() != ID_bool ||
33+
implies_expr.op1().type().id() != ID_bool)
3434
{
3535
return unchanged(expr);
3636
}
3737

3838
// turn a => b into !a || b
3939

40-
auto new_expr = expr;
40+
binary_exprt new_expr = implies_expr;
4141
new_expr.id(ID_or);
4242
new_expr.op0() = boolean_negate(new_expr.op0());
4343
simplify_node(new_expr);

0 commit comments

Comments
 (0)