-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Standard library support + DafnyStdLibs.Wrappers (#4678)
### Description This change adds support for "standard libraries" that are packaged together with the Dafny distribution, at least for now. They are automatically available for import with the option `--standard-libraries`, which will likely become true by default in Dafny 5. To avoid Dafny's footprint from getting larger and larger over time, some portion of them may be moved into separately distributed packages at a later date. They will remain optional and the Dafny language itself should not depend on them. A later change will likely add pre-translated source to the runtimes as well, and a translation option such as `--include-standard-libraries` similar to `--include-runtime` to rely on this copy of them instead of translating them into every component. Implementation notes: * The primary implementation approach, which is mostly not user-visible, is to pre-build one or more `.doo` files and embed them in `DafnyPipeline.dll`, just as we already do with the various runtime files such as `DafnyRuntime.dll`. They are added as input `DafnyFiles`, using URIs of the form `dllresource://DafnyPipeline/<name>.doo`, so they are not re-verified but are in scope for compilation. * I've fixed/improved a few things around `.doo` files, such as loosening the library checks for some options, and no longer checking options that only affect compilation (it may make sense to leverage these files for compilation compatibility checking in the future but that's not currently in scope). * The current limitations of the standard library support are documented in `Source/DafnyStandardLibraries/CONTRIBUTING.md`, and should make it clear which pending libraries are still partially blocked. ### How has this been tested? * The general standard library support is tested with the integration tests under `stdlibs` and `metatests/StdLibsOffByDefaultInTests.dfy` * The Wrappers library is tested via `WrappersExamples.dfy` --------- Co-authored-by: Remy Willems <[email protected]>
- Loading branch information
1 parent
3109763
commit 38416f8
Showing
39 changed files
with
1,543 additions
and
130 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build and Test Dafny Standard Libraries | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [ master, main-* ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-deep-tests: | ||
uses: ./.github/workflows/check-deep-tests-reusable.yml | ||
|
||
build: | ||
needs: check-deep-tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Dafny | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Set up JDK 18 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 18 | ||
distribution: corretto | ||
- name: Build Dafny | ||
run: dotnet build Source/Dafny.sln | ||
- name: Get Z3 | ||
run: make z3-ubuntu | ||
- run: npm install bignumber.js | ||
- name: Test DafnyStandardLibraries | ||
run: make -C Source/DafnyStandardLibraries all | ||
|
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.