|
12 | 12 |
|
13 | 13 | #include <util/std_expr.h>
|
14 | 14 | #include <util/base_type.h>
|
| 15 | +#include <util/invariant.h> |
15 | 16 |
|
16 | 17 | #include <langapi/language_util.h>
|
17 | 18 |
|
18 | 19 | #include "flatten_byte_operators.h"
|
19 | 20 |
|
20 | 21 | literalt boolbvt::convert_equality(const equal_exprt &expr)
|
21 | 22 | {
|
22 |
| - if(!base_type_eq(expr.lhs().type(), expr.rhs().type(), ns)) |
23 |
| - { |
24 |
| - std::cout << "######### lhs: " << expr.lhs().pretty() << '\n'; |
25 |
| - std::cout << "######### rhs: " << expr.rhs().pretty() << '\n'; |
26 |
| - throw "equality without matching types"; |
27 |
| - } |
| 23 | + const bool is_base_type_eq = |
| 24 | + base_type_eq(expr.lhs().type(), expr.rhs().type(), ns); |
| 25 | + DATA_INVARIANT( |
| 26 | + is_base_type_eq, |
| 27 | + std::string("equality without matching types:\n") + "######### lhs: " + |
| 28 | + expr.lhs().pretty() + '\n' + "######### rhs: " + expr.rhs().pretty()); |
28 | 29 |
|
29 | 30 | // see if it is an unbounded array
|
30 | 31 | if(is_unbounded_array(expr.lhs().type()))
|
@@ -68,12 +69,13 @@ literalt boolbvt::convert_verilog_case_equality(
|
68 | 69 | // This is 4-valued comparison, i.e., z===z, x===x etc.
|
69 | 70 | // The result is always Boolean.
|
70 | 71 |
|
71 |
| - if(!base_type_eq(expr.lhs().type(), expr.rhs().type(), ns)) |
72 |
| - { |
73 |
| - std::cout << "######### lhs: " << expr.lhs().pretty() << '\n'; |
74 |
| - std::cout << "######### rhs: " << expr.rhs().pretty() << '\n'; |
75 |
| - throw "verilog_case_equality without matching types"; |
76 |
| - } |
| 72 | + const bool is_base_type_eq = |
| 73 | + base_type_eq(expr.lhs().type(), expr.rhs().type(), ns); |
| 74 | + DATA_INVARIANT( |
| 75 | + is_base_type_eq, |
| 76 | + std::string("verilog_case_equality without matching types:\n") + |
| 77 | + "######### lhs: " + expr.lhs().pretty() + '\n' + |
| 78 | + "######### rhs: " + expr.rhs().pretty()); |
77 | 79 |
|
78 | 80 | const bvt &bv0=convert_bv(expr.lhs());
|
79 | 81 | const bvt &bv1=convert_bv(expr.rhs());
|
|
0 commit comments