-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into proof_refactoring_suggestions
- Loading branch information
Showing
25 changed files
with
190 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
### from https://github.com/github/gitignore/blob/main/Python.gitignore | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# Environments | ||
.env | ||
venv/ |
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,62 @@ | ||
# Building the DafnyRuntimePython | ||
|
||
## Prerequisites | ||
|
||
- the `dotnet` CLI, to build Dafny | ||
- Python, to build and upload the package | ||
- [TestPyPI credentials](https://packaging.python.org/en/latest/guides/using-testpypi/), if you will upload to TestPyPI | ||
- PyPI credentials, if you will upload to PyPI | ||
|
||
## Steps | ||
|
||
1. Ensure that the `System_` module is up-to-date: | ||
|
||
```bash | ||
# Ensure that the Dafny build is up-to-date, | ||
# as it will be used to compile the System_ module. | ||
$ dotnet build --project ../../Dafny | ||
|
||
# Compile the System_ runtime module. | ||
$ make update-system-module | ||
``` | ||
|
||
2. Build the distribution package: | ||
|
||
```bash | ||
# Set up the build tooling | ||
$ make setup-venv | ||
|
||
# Remove old build artifacts | ||
$ make clean-package | ||
|
||
# Build the distribution package | ||
$ make build-package | ||
``` | ||
|
||
3. Check that the distribution package looks right locally and on TestPyPI, | ||
as (production) PyPI does not allow overwriting uploaded packages: | ||
|
||
```bash | ||
# List the distribution package's files, and check that: | ||
# 1. the version number is correct | ||
# 2. the `System_/__init__.py` file exists | ||
# 3. the `dafny/__init__.py` file exists | ||
$ tar tf dist/dafnyruntimepython-X.Y.Z.tar.gz | ||
|
||
# Upload to TestPyPI, and check that it appears correct at | ||
# <https://test.pypi.org/project/DafnyRuntimePython/>. | ||
$ make upload-package-testpypi | ||
``` | ||
|
||
4. Upload to PyPI: | ||
|
||
```bash | ||
$ make upload-package-pypi | ||
``` | ||
|
||
You can view the uploaded package at <https://pypi.org/project/DafnyRuntimePython/>. | ||
|
||
## More info | ||
|
||
The packaging process is described in | ||
<https://packaging.python.org/en/latest/tutorials/packaging-projects/> |
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
File renamed without changes.
File renamed without changes.
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,24 @@ | ||
[project] | ||
name = "DafnyRuntimePython" | ||
version = "4.8.1" | ||
authors = [ | ||
{ name = "The Dafny core team", email = "[email protected]" }, | ||
] | ||
description = "Dafny runtime for Python" | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/dafny-lang/dafny" | ||
Issues = "https://github.com/dafny-lang/dafny/issues" | ||
|
||
[build-system] | ||
requires = ["setuptools>=61.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools] | ||
packages = ["_dafny", "System_"] |
8 changes: 8 additions & 0 deletions
8
Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/functions/constantWithReveal.dfy
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,8 @@ | ||
// RUN: %verify %s &> "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
opaque function Foo(x: int): int { | ||
x | ||
} | ||
|
||
const C := reveal Foo(); Foo(42) |
2 changes: 2 additions & 0 deletions
2
...e/IntegrationTests/TestFiles/LitTests/LitTest/ast/functions/constantWithReveal.dfy.expect
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,2 @@ | ||
|
||
Dafny program verifier finished with 1 verified, 0 errors |
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
11 changes: 5 additions & 6 deletions
11
Source/IntegrationTests/TestFiles/LitTests/LitTest/comp/ExternCtors.dfy
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 |
---|---|---|
@@ -1,24 +1,23 @@ | ||
// RUN: %run --target cs "%s" --input %S/ExternCtors-externs/Library.cs > "%t" | ||
// RUN: %run --target java "%s" --input %S/ExternCtors-externs/Class.java >> "%t" | ||
// RUN: %run --target py "%s" --input %S/ExternCtors-externs/Library.py >> "%t" | ||
// RUN: %run --target go "%s" --input %S/ExternCtors-externs/Library.go >> "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
// FIXME: Extern constructors are currently broken in Go and JavaScript, | ||
// so they are omitted | ||
// FIXME: Extern constructors are currently broken in JavaScript, | ||
// so that is omitted | ||
|
||
method Main() { | ||
Library.Class.SayHi(); | ||
var obj := new Library.Class(42); | ||
obj.Print(); | ||
print "My value is ", obj.Get(), "\n"; | ||
} | ||
|
||
module {:extern "Library"} Library { | ||
class {:extern} Class { | ||
constructor {:extern} (n: int) | ||
static method {:extern} SayHi() | ||
function {:extern} Get() : int | ||
method Print() { | ||
print "My value is ", Get(), "\n"; | ||
} | ||
} | ||
} | ||
|
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
2 changes: 1 addition & 1 deletion
2
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/SubsetTypes.dfy
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
18 changes: 18 additions & 0 deletions
18
Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/github-issue-5814.dfy
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,18 @@ | ||
// RUN: %testDafnyForEachCompiler "%s" | ||
|
||
trait MyTrait<T> { | ||
method Bar(ghost x: T, y: T) returns (z: T) | ||
} | ||
|
||
class MyClass extends MyTrait<int> { | ||
constructor() {} | ||
method Bar(ghost x: int, y: int) returns (z: int) { | ||
return y; | ||
} | ||
} | ||
|
||
method Main() { | ||
var c := new MyClass(); | ||
var z := c.Bar(7, 42); | ||
expect z == 42; | ||
} |
Empty file.
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 @@ | ||
Added opaque blocks to the language. Opaque blocks enable improving verification performance. See the documentation for more details. |
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 @@ | ||
By blocks ("... by { ... }") are now available for assert statements, call statements, and the three types of assignments (:=, :-, :|). Also, by blocks should now be more intuitive since they enable proving any assertions on the left-hand side of the 'by', not just the 'outermost' one. For example, previously `assert 3 / x == 1 by { assume x == 3; }` could still give a possible division by zero error, but now it won't. |
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 @@ | ||
Fix a bug that prevented using reveal statement expressions in the body of a constant. |