Support recursive contracts
#[derive(Clone, PartialEq)]
struct Expr;
impl Expr {
// ensure an expression has a value. convert
// - arrays -> pointers
// - functions -> pointers
// - variables -> value stored in that variable
// 6.3.2.1 Lvalues, arrays, and function designators
// > Except when it is the operand of [a bunch of different operators],
// > an lvalue that does not have array type is converted to the value stored in the designated object (and is no longer an lvalue)
#[contracts::post(ret == ret.clone().rval())]
fn rval(self) -> Expr {
unimplemented!()
}
}
When I run this example in test mode, I get an immediate stack overflow:
thread 'analyze::expr::test::test_funcall' has overflowed its stack
fatal runtime error: stack overflow
Maybe a good way to support this is by setting an internal counter of how many times the postcondition has been run, and only rerunning it the first time?