WhileyCompiler icon indicating copy to clipboard operation
WhileyCompiler copied to clipboard

Flow Typing Specification Elements

Open DavePearce opened this issue 4 years ago • 1 comments

This doesn't type check, but looks technically legit (Reference_Valid_39):

type List is &{int data, null|List next }

method fill(List l, int v)
ensures l->data == v
ensures (l->next is List) ==> *(l->next) == old(*(l->next)):
    l->data = v

The problem is that it won't retype l, even though it makes sense to do so in this context.

DavePearce avatar Oct 08 '21 01:10 DavePearce

I did manage to workaround this with a property:

property unchanged2({int data, null|List next} node)
// My data is unchanged
where node.data == old(node.data)
// Everything else is also unchanged
where unchanged(node.next)

DavePearce avatar Oct 08 '21 02:10 DavePearce