-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate UI code and business logic for the resolve and verify comman…
…ds (#4798) ### Changes At the heart of this PR is an architectural change: to lay the foundation for separating UI code from business logic. Part of this is to use Boogie purely as an API, instead of as a library that produces textual output for the CLI. This change is not _necessary_, but I believe it is a good step towards giving us more control over the UI experience of our CLI, and to make it easier to work with our codebase. In the future section down below are some ideas of what this PR enables. Because there is a lot of UI code intermingled with a lot of business code, making this architectural change produces a lot of code changes, so this PR only takes the first step: the pathway where UI and logic are separated is only used when using `dafny resolve` or `dafny verify`. I will update the remaining commands in follow-up PRs. #### Refactoring - Move `Compilation`, a UI agnostic back-end for driving the Dafny compiler pipeline, from the project `LanguageServer` to `DafnyCore`, so it can be used by the CLI as well. - Introduce `CliCompilation` which uses the CLI as a user interface to track the results of `Compilation`. - Let the commands `dafny resolve` and `dafny verify` use `CliCompilation` instead of `CompilerDriver `. - Due to the introduction of `CliCompilation`, rename `CompilerDriver` to `LegacyCliCompilation`, even though there are many features `CliCompilation` does not support yet. - Remove `DafnySymbolKind` from DafnyCore, which was a duplicate of an LSP enum that is now directly accessible in DafnyCore #### Behavior - Make it easy to update .expect files by setting the flag `DiffCommand.UpdateExpectFile` to true. This was broken before this PR. - Configure littish tests so they time out after running for 120 minutes. They normally complete in less than 30m on all platforms, so 120m should be ample. - Fix a bug in the cloning code, that was discovered because the CLI tests are using the server back-end code, which clones the program after parsing. (Is this good or bad? In the future I hope we'll have an immutable AST so then the question becomes redundant) - Make the order in which verification error are shown on the CLI consistent. Now errors are always shown in the order in which they occur in the file Example diff: ``` - git-issue-4074.dfy(24,11): Error: assertion might not hold git-issue-4074.dfy(5,9): Error: assertion might not hold git-issue-4074.dfy(14,11): Error: assertion might not hold + git-issue-4074.dfy(24,11): Error: assertion might not hold ``` - Consistently let CLI diagnostics have a Warning/Error label. Example diff: ``` - github-issue-4804.dfy(19,8): Verification out of resource (Power.LemmaPowSubAddCancel (correctness)) + github-issue-4804.dfy(19,8): Error: Verification out of resource (Power.LemmaPowSubAddCancel (correctness)) ``` - The way in which custom error messages is shown is slightly different. Example diff: ``` CustomErrorMesage.dfy(42,63): Error: this loop invariant could not be proved on entry - CustomErrorMesage.dfy(42,63): Related message: position variable out of range + Related message: position variable out of range ``` ### Future This PR paves the way for: - Adding a `--filter` option that operates on Dafny symbols/files, and possibly also filters parsing and resolution - Update the CLI output. - Removed useless "related message" output. Example below this list. - Improve summary output. Dafny currently reports `Dafny program verifier finished with 21 verified, 0 errors` but the number 21 does not refer to anything visible to the user. It would be better to report the number of Dafny symbols that were verified. - Do not report `Dafny program verifier did not attempt verification` when running `dafny resolve` ``` Definedness.dfy(175,27): Error: this loop invariant could not be proved on entry - Definedness.dfy(175,27): Related message: loop invariant violation ``` ### How has this been tested? - Updated existing tests to account for behavioral changes <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
- Loading branch information
1 parent
fecf783
commit 9d85655
Showing
218 changed files
with
1,797 additions
and
1,396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.