Skip to content
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

Error documentation improvement #5132

Closed
MikaelMayer opened this issue Feb 29, 2024 · 0 comments · Fixed by #5142
Closed

Error documentation improvement #5132

MikaelMayer opened this issue Feb 29, 2024 · 0 comments · Fixed by #5142
Labels
area: error-reporting Clarity of the error reporting

Comments

@MikaelMayer
Copy link
Member

Consider this program (credits to @robin-aws )

 class C {
   var x: nat
   constructor(x: nat) 
     ensures this.x == x
   {
     this.x := x;
   }
 }
 
 method Foo() {
   var c := new C(42);
   assert c.x == 42;
   assert fresh(c);
 
   assert IsFresh(c); // Error: argument ('c') might not be allocated in the two-state function's previous state
 }
 
 twostate predicate IsFresh(c: C) {
   fresh(c)
 }

We should change the error message to

Error: argument ('c') might not be allocated in the two-state function's previous state. Did you miss 'new' before the parameter declaration, like 'new c: C' ? It allows unallocated parameters explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: error-reporting Clarity of the error reporting
Projects
None yet
1 participant