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

Behavior of havoc operator in combination with definite assignment is not well explained in error messages #5362

Open
keyboardDrummer opened this issue Apr 25, 2024 · 0 comments
Labels
during 1: program development Bad error message or documentation; IDE bug; crash compiling invalid program kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny

Comments

@keyboardDrummer
Copy link
Member

I believe in the following example, Dafny handles havoc assignment * differently for types that have a default value and those that do not, but this is not reflected in the error messages.

method myMethod(m: int) returns (b:bool) { return true; }

method mainHavoc(){
    var t: int := *;
    var r:= myMethod(t);    // no error
}

trait T extends object {}
method myMethod2(m: T?) returns (b:bool) { return true; }

method mainHavoc2(){
    var t: T := *; // error on the next line goes away if change this to T?
    var r:= myMethod2(t);    //FAILS: variable 't', which is subject to definite-assignment rules, might be uninitialized here
}
@keyboardDrummer keyboardDrummer added kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny during 1: program development Bad error message or documentation; IDE bug; crash compiling invalid program labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
during 1: program development Bad error message or documentation; IDE bug; crash compiling invalid program kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny
Projects
None yet
Development

No branches or pull requests

1 participant