Skip to content

Commit 427e809

Browse files
Replace "some fixes" step in rename by invariant
This should not be necessary as the renaming works correctly. The asserting no modification in necessary in the concerned cases.
1 parent 3a8b34d commit 427e809

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/goto-symex/goto_symex_state.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -343,25 +343,20 @@ void goto_symex_statet::rename(
343343
}
344344
else
345345
{
346-
// this could go wrong, but we would have to re-typecheck ...
347346
rename(expr.type(), irep_idt(), ns, level);
348347

349348
// do this recursively
350349
Forall_operands(it, expr)
351350
rename(*it, ns, level);
352351

353-
// some fixes
354-
if(expr.id()==ID_with)
355-
expr.type()=to_with_expr(expr).old().type();
356-
else if(expr.id()==ID_if)
357-
{
358-
DATA_INVARIANT(
359-
to_if_expr(expr).true_case().type() ==
360-
to_if_expr(expr).false_case().type(),
361-
"true case of to_if_expr should be of same type "
362-
"as false case");
363-
expr.type()=to_if_expr(expr).true_case().type();
364-
}
352+
INVARIANT(
353+
(expr.id() != ID_with ||
354+
expr.type() == to_with_expr(expr).old().type()) &&
355+
(expr.id() != ID_if ||
356+
(expr.type() == to_if_expr(expr).true_case().type()) &&
357+
(expr.type() == to_if_expr(expr).false_case().type())),
358+
"Type of renamed expr should be the same as operands for with_exprt and "
359+
"if_exprt");
365360
}
366361
}
367362

0 commit comments

Comments
 (0)