@@ -12,6 +12,7 @@ Author: Daniel Kroening, kroening@kroening.com
1212#include < util/mathematical_types.h>
1313
1414#include " smv_expr.h"
15+ #include " smv_types.h"
1516
1617/* ******************************************************************\
1718
@@ -337,6 +338,12 @@ expr2smvt::resultt expr2smvt::convert_typecast(const typecast_exprt &expr)
337338 return convert_rec (smv_resize_exprt{expr.op (), dest_width, dest_type});
338339 }
339340 }
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+ }
340347 else
341348 return convert_norep (expr);
342349}
@@ -593,10 +600,9 @@ expr2smvt::resultt expr2smvt::convert_constant(const constant_exprt &src)
593600 else
594601 dest+=" FALSE" ;
595602 }
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)
600606 {
601607 dest = id2string (src.get_value ());
602608 }
@@ -903,15 +909,15 @@ std::string type2smv(const typet &type, const namespacet &ns)
903909 code += type2smv (to_array_type (type).element_type (), ns);
904910 return code;
905911 }
906- else if (type.id ()==ID_enumeration )
912+ else if (type.id () == ID_smv_enumeration )
907913 {
908- const irept::subt & elements= to_enumeration_type (type).elements ();
914+ auto elements = to_smv_enumeration_type (type).elements ();
909915 std::string code = " { " ;
910916 bool first=true ;
911917 for (auto &element : elements)
912918 {
913919 if (first) first=false ; else code+=" , " ;
914- code += element. id_string ( );
920+ code += id2string (element );
915921 }
916922 code+=" }" ;
917923 return code;
0 commit comments