|
12 | 12 | #include <util/mathematical_types.h> |
13 | 13 |
|
14 | 14 | #include "smv_expr.h" |
| 15 | +#include "smv_types.h" |
15 | 16 |
|
16 | 17 | /*******************************************************************\ |
17 | 18 |
|
@@ -337,6 +338,12 @@ expr2smvt::resultt expr2smvt::convert_typecast(const typecast_exprt &expr) |
337 | 338 | return convert_rec(smv_resize_exprt{expr.op(), dest_width, dest_type}); |
338 | 339 | } |
339 | 340 | } |
| 341 | + else if( |
| 342 | + src_type.id() == ID_smv_enumeration && dest_type.id() == ID_smv_enumeration) |
| 343 | + { |
| 344 | + // added by SMV typechecker, implicit |
| 345 | + return convert_rec(expr.op()); |
| 346 | + } |
340 | 347 | else |
341 | 348 | return convert_norep(expr); |
342 | 349 | } |
@@ -593,10 +600,9 @@ expr2smvt::resultt expr2smvt::convert_constant(const constant_exprt &src) |
593 | 600 | else |
594 | 601 | dest+="FALSE"; |
595 | 602 | } |
596 | | - else if(type.id()==ID_integer || |
597 | | - type.id()==ID_natural || |
598 | | - type.id()==ID_range || |
599 | | - type.id()==ID_enumeration) |
| 603 | + else if( |
| 604 | + type.id() == ID_integer || type.id() == ID_natural || |
| 605 | + type.id() == ID_range || type.id() == ID_smv_enumeration) |
600 | 606 | { |
601 | 607 | dest = id2string(src.get_value()); |
602 | 608 | } |
@@ -903,15 +909,15 @@ std::string type2smv(const typet &type, const namespacet &ns) |
903 | 909 | code += type2smv(to_array_type(type).element_type(), ns); |
904 | 910 | return code; |
905 | 911 | } |
906 | | - else if(type.id()==ID_enumeration) |
| 912 | + else if(type.id() == ID_smv_enumeration) |
907 | 913 | { |
908 | | - const irept::subt &elements=to_enumeration_type(type).elements(); |
| 914 | + auto elements = to_smv_enumeration_type(type).elements(); |
909 | 915 | std::string code = "{ "; |
910 | 916 | bool first=true; |
911 | 917 | for(auto &element : elements) |
912 | 918 | { |
913 | 919 | if(first) first=false; else code+=", "; |
914 | | - code += element.id_string(); |
| 920 | + code += id2string(element); |
915 | 921 | } |
916 | 922 | code+=" }"; |
917 | 923 | return code; |
|
0 commit comments