dafny-lang / dafny

Dafny is a verification-aware programming language
https://dafny.org
Other
2.88k stars 256 forks source link

`{:only}` issues #5730

Open MikaelMayer opened 2 weeks ago

MikaelMayer commented 2 weeks ago

Dafny version

latest-nightly

Code to produce this issue

// file1.dfy
module X {
  method {:only} VerifyMe() {
    assert true;
  }
}

// file2.dfy
include "file1.dfy"
module Y {
  import X
  method VerifyMeToo() {
    assert false;        // Gutter icons in VSCode show that this method is verified
  }
}

Command to run and resulting output

$ dafny verify --filter-symbol "VerifyMeToo" file2.dfy
file1.dfy(2,9): Warning: Members with {:only} temporarily disable the verification of other members in the entire file
  |
2 |   method {:only} VerifyMe() {
  |          ^^^^^^^

Dafny program verifier finished with 0 verified, 0 errors
Compilation failed because warnings were found and --allow-warnings is false

What happened?

image Four issues there:

What type of operating system are you experiencing the problem on?

Windows

keyboardDrummer commented 2 weeks ago

We now have some IDE (play icon) and CLI options (--filter-symbol/--filter-position) to verify specific things. What's still missing from the IDE is an option to verify individual assertions.

However, once we have that, is there still a use-case for {:only}? To me the act of making source changes to help development does not seem like a good UX, and can even be unsafe when those changes are accidentally committed.