diff --git a/.github/workflows/integration-tests-reusable.yml b/.github/workflows/integration-tests-reusable.yml
index 905c86531e2..f5d1ed29aab 100644
--- a/.github/workflows/integration-tests-reusable.yml
+++ b/.github/workflows/integration-tests-reusable.yml
@@ -139,7 +139,7 @@ jobs:
DAFNY_RELEASE: ${{ github.workspace }}\unzippedRelease\dafny
run: |
cmd /c mklink D:\a\dafny\dafny\unzippedRelease\dafny\z3\bin\z3-4.12.1 D:\a\dafny\dafny\unzippedRelease\dafny\z3\bin\z3-4.12.1.exe
- dotnet test --logger trx --logger "console;verbosity=normal" --collect:"XPlat Code Coverage" dafny/Source/IntegrationTests/IntegrationTests.csproj
+ dotnet test --logger trx --logger "console;verbosity=normal" --collect:"XPlat Code Coverage" --settings dafnySource/IntegrationTests/coverlet.runsettings dafny/Source/IntegrationTests/IntegrationTests.csproj
- name: Generate tests (non-Windows)
## This step creates lit tests from examples in documentation
## These are then picked up by the integration tests below
diff --git a/.github/workflows/xunit-tests-reusable.yml b/.github/workflows/xunit-tests-reusable.yml
index dff2b0da5a7..3991a237c18 100644
--- a/.github/workflows/xunit-tests-reusable.yml
+++ b/.github/workflows/xunit-tests-reusable.yml
@@ -66,25 +66,25 @@ jobs:
- name: Build
run: dotnet build --no-restore ${{env.solutionPath}}
- name: Run DafnyCore Tests
- run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" Source/DafnyCore.Test
+ run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" --settings Source/DafnyCore.Test/coverlet.runsettings Source/DafnyCore.Test
- name: Run DafnyLanguageServer Tests
run: |
## Run twice to catch unstable code (Issue #2673)
- dotnet test --no-restore --blame-hang-timeout 360s --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" Source/DafnyLanguageServer.Test
+ dotnet test --no-restore --blame-hang-timeout 360s --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" --settings Source/DafnyLanguageServer.Test/coverlet.runsettings Source/DafnyLanguageServer.Test
## On the second run, collect test coverage data
## Note that, for some mysterious reason, --collect doesn't work with the DafnyLanguageServer.Test package
dotnet coverage collect -o DafnyLanguageServer.Test.coverage dotnet test --no-restore --blame-hang-timeout 360s --logger "console;verbosity=normal" --logger trx Source/DafnyLanguageServer.Test
- name: Run DafnyDriver Tests
- run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" Source/DafnyDriver.Test
+ run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" --settings Source/DafnyDriver.Test/coverlet.runsettings Source/DafnyDriver.Test
- name: Run DafnyPipeline Tests
- run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" Source/DafnyPipeline.Test
+ run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" --settings Source/DafnyPipeline.Test/coverlet.runsettings Source/DafnyPipeline.Test
- name: Run DafnyTestGeneration Tests
- run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" Source/DafnyTestGeneration.Test
+ run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" --settings Source/DafnyTestGeneration.Test/coverlet.runsettings Source/DafnyTestGeneration.Test
- name: Run AutoExtern Tests
- run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" Source/AutoExtern.Test
+ run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" --settings Source/AutoExtern.Test/coverlet.runsettings Source/AutoExtern.Test
- name: Run DafnyRuntime Tests
- run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" Source/DafnyRuntime.Tests
+ run: dotnet test --no-restore --logger "console;verbosity=normal" --logger trx --collect:"XPlat Code Coverage" --settings Source/DafnyRuntime.Tests/coverlet.runsettings Source/DafnyRuntime.Tests
- uses: actions/upload-artifact@v3
if: always()
with:
diff --git a/Source/AutoExtern.Test/coverlet.runsettings b/Source/AutoExtern.Test/coverlet.runsettings
new file mode 100644
index 00000000000..11c8afc63f8
--- /dev/null
+++ b/Source/AutoExtern.Test/coverlet.runsettings
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ [*]DAST.*,[*]DCOMP.*
+
+
+
+
+
diff --git a/Source/DafnyCore.Test/coverlet.runsettings b/Source/DafnyCore.Test/coverlet.runsettings
new file mode 100644
index 00000000000..11c8afc63f8
--- /dev/null
+++ b/Source/DafnyCore.Test/coverlet.runsettings
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ [*]DAST.*,[*]DCOMP.*
+
+
+
+
+
diff --git a/Source/DafnyCore/Compilers/Dafny/AST.dfy b/Source/DafnyCore/Compilers/Dafny/AST.dfy
index f8189caa350..014b4a0fcaf 100644
--- a/Source/DafnyCore/Compilers/Dafny/AST.dfy
+++ b/Source/DafnyCore/Compilers/Dafny/AST.dfy
@@ -15,9 +15,9 @@ module {:extern "DAST"} DAST {
Primitive(Primitive) | Passthrough(string) |
TypeArg(Ident)
- datatype Primitive = String | Bool | Char
+ datatype Primitive = Int | Real | String | Bool | Char
- datatype ResolvedType = Datatype(path: seq) | Trait(path: seq) | Newtype
+ datatype ResolvedType = Datatype(path: seq) | Trait(path: seq) | Newtype(Type)
datatype Ident = Ident(id: string)
@@ -62,8 +62,7 @@ module {:extern "DAST"} DAST {
New(path: seq, args: seq) |
NewArray(dims: seq) |
DatatypeValue(path: seq, variant: string, isCo: bool, contents: seq<(string, Expression)>) |
- SubsetUpgrade(value: Expression, typ: Type) |
- SubsetDowngrade(value: Expression) |
+ Convert(value: Expression, from: Type, typ: Type) |
SeqValue(elements: seq) |
SetValue(elements: seq) |
This() |
@@ -82,5 +81,5 @@ module {:extern "DAST"} DAST {
datatype UnaryOp = Not | BitwiseNot | Cardinality
- datatype Literal = BoolLiteral(bool) | IntLiteral(int) | DecLiteral(string) | StringLiteral(string) | CharLiteral(char) | Null
+ datatype Literal = BoolLiteral(bool) | IntLiteral(string, Type) | DecLiteral(string, string, Type) | StringLiteral(string) | CharLiteral(char) | Null
}
diff --git a/Source/DafnyCore/Compilers/Dafny/ASTBuilder.cs b/Source/DafnyCore/Compilers/Dafny/ASTBuilder.cs
index 22ba8ee5dbd..800cb3000e2 100644
--- a/Source/DafnyCore/Compilers/Dafny/ASTBuilder.cs
+++ b/Source/DafnyCore/Compilers/Dafny/ASTBuilder.cs
@@ -831,14 +831,8 @@ IIFEExprBuilder IIFE(string name, DAST.Type tpe) {
return ret;
}
- SubsetUpgradeBuilder SubsetUpgrade(DAST.Type tpe) {
- var ret = new SubsetUpgradeBuilder(tpe);
- AddBuildable(ret);
- return ret;
- }
-
- SubsetDowngradeBuilder SubsetDowngrade() {
- var ret = new SubsetDowngradeBuilder();
+ ConvertBuilder Convert(DAST.Type fromType, DAST.Type toType) {
+ var ret = new ConvertBuilder(fromType, toType);
AddBuildable(ret);
return ret;
}
@@ -1062,12 +1056,14 @@ public void AddBuildable(BuildableExpr item) {
}
}
-class SubsetUpgradeBuilder : ExprContainer, BuildableExpr {
- readonly DAST.Type tpe;
+class ConvertBuilder : ExprContainer, BuildableExpr {
+ readonly DAST.Type fromType;
+ readonly DAST.Type toType;
object value = null;
- public SubsetUpgradeBuilder(DAST.Type tpe) {
- this.tpe = tpe;
+ public ConvertBuilder(DAST.Type fromType, DAST.Type toType) {
+ this.fromType = fromType;
+ this.toType = toType;
}
public void AddExpr(DAST.Expression item) {
@@ -1090,38 +1086,10 @@ public DAST.Expression Build() {
var builtValue = new List();
ExprContainer.RecursivelyBuild(new List