mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
prevent re-declaration of enumeration sort names
preventing redeclaration of all ADT cases is not part of this update.
This commit is contained in:
parent
c3c45f495a
commit
86f3702403
3 changed files with 28 additions and 15 deletions
|
@ -102,6 +102,13 @@ extern "C" {
|
|||
sort* e;
|
||||
|
||||
ptr_vector<constructor_decl> constrs;
|
||||
symbol sname = to_symbol(name);
|
||||
|
||||
if (mk_c(c)->get_dt_plugin()->is_declared(sname)) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
symbol e_name(to_symbol(enum_names[i]));
|
||||
std::string recognizer_s("is_");
|
||||
|
@ -112,8 +119,9 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, n, constrs.data());
|
||||
datatype_decl * dt = mk_datatype_decl(dt_util, sname, 0, nullptr, n, constrs.data());
|
||||
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, nullptr, sorts);
|
||||
del_datatype_decl(dt);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue