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

{:only} issues #5730

Open
MikaelMayer opened this issue Aug 29, 2024 · 3 comments
Open

{:only} issues #5730

MikaelMayer opened this issue Aug 29, 2024 · 3 comments
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label

Comments

@MikaelMayer
Copy link
Member

MikaelMayer commented Aug 29, 2024

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:

  • The warning about the {:only} is not mentioned in VSCode, only on the command-line.
  • The gutter icons are green. If we inlined the included file, it would fix this and the previous issue.
  • The method itself has no warning indicating it's not verified.
  • The documentation states that it deactivate verification of other methods in the same file but that extends beyond the file in which {:only} was written.

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

Windows

@MikaelMayer MikaelMayer added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Aug 29, 2024
@dafny-lang dafny-lang deleted a comment Aug 29, 2024
@keyboardDrummer
Copy link
Member

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.

@MikaelMayer
Copy link
Member Author

{:only} is more useful as assume false; nowadays. What is unsafe is to ignore warnings.

On my side, I'm not using the IDE UX that requires clicking on buttons to verify my code. I prefer that everything happens automatically whenever I type something. If you can trigger verification on change with your mode, while making it possible to restrict verification to some methods, then I personally won't use {:only}.

@keyboardDrummer
Copy link
Member

{:only} is more useful as assume false; nowadays. What is unsafe is to ignore warnings.

On my side, I'm not using the IDE UX that requires clicking on buttons to verify my code. I prefer that everything happens automatically whenever I type something. If you can trigger verification on change with your mode, while making it possible to restrict verification to some methods, then I personally won't use {:only}.

Fair

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
Projects
None yet
Development

No branches or pull requests

2 participants