Skip to content

Replace "some fixes" step in rename by invariant #3993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions src/goto-symex/goto_symex_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,25 +343,20 @@ void goto_symex_statet::rename(
}
else
{
// this could go wrong, but we would have to re-typecheck ...
rename(expr.type(), irep_idt(), ns, level);

// do this recursively
Forall_operands(it, expr)
rename(*it, ns, level);

// some fixes
if(expr.id()==ID_with)
expr.type()=to_with_expr(expr).old().type();
else if(expr.id()==ID_if)
{
DATA_INVARIANT(
to_if_expr(expr).true_case().type() ==
to_if_expr(expr).false_case().type(),
"true case of to_if_expr should be of same type "
"as false case");
expr.type()=to_if_expr(expr).true_case().type();
}
INVARIANT(
(expr.id() != ID_with ||
expr.type() == to_with_expr(expr).old().type()) &&
(expr.id() != ID_if ||
(expr.type() == to_if_expr(expr).true_case().type() &&
expr.type() == to_if_expr(expr).false_case().type())),
"Type of renamed expr should be the same as operands for with_exprt and "
"if_exprt");
}
}

Expand Down