forked from dafny-lang/dafny
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix naming of formals in Translator (dafny-lang#2266)
Fixes dafny-lang#2263, which is due to inconsistent naming of formal parameters in automatically generated function handles. Explanation: The syntax of `MkTyParamFormals` was changed with commit dafny-lang@81cf582 from ```cs List<Bpl.Variable> MkTyParamFormals(List<TypeParameter> args, bool named = true) ``` to ```cs List<Variable> MkTyParamFormals(List<TypeParameter> args, bool includeWhereClause, bool named = true) ``` But the call to the method [on this line](https://github.com/dafny-lang/dafny/blob/fcc912f9b117115cbc8b2273800397e88d3c1e53/Source/Dafny/Verifier/Translator.cs#L6855) was left unchanged, so the method is now being called with `named` field set to the default `true`. [Elsewhere](https://github.com/dafny-lang/dafny/blob/fcc912f9b117115cbc8b2273800397e88d3c1e53/Source/Dafny/Verifier/Translator.cs#L6882) the formal parameters of the a function handle don't get a name. The result is a mix-match of named and unnamed formals that causes the bug reported in the linked issue. I don't completely understand the meaning of `includeWhereClause` in this context but I think `false` is the correct value for this call? --------- Co-authored-by: Sasha Fedchin <[email protected]> Co-authored-by: Aaron Tomb <[email protected]> Co-authored-by: Robin Salkeld <[email protected]>
- Loading branch information
1 parent
bb10e38
commit 889e051
Showing
8 changed files
with
71 additions
and
9 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,13 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace XUnitExtensions.Lit { | ||
|
||
public class DotnetToolCommand : ShellLitCommand { | ||
|
||
private static readonly string[] DotnetToolArgs = { "tool", "run" }; | ||
|
||
public DotnetToolCommand(string dotnetToolName, IEnumerable<string> arguments, IEnumerable<string> passthroughEnvironmentVariables) : | ||
base("dotnet", DotnetToolArgs.Append(dotnetToolName).Concat(arguments), passthroughEnvironmentVariables) { } | ||
} | ||
} |
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,5 @@ | ||
// RUN: %dafny /compile:0 /noVerify /print:%t.bpl "%s" | ||
// RUN: %boogie "%t.bpl" > "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
function Test(f: (int ~> bool)): (b:bool) reads f.reads { true } |
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 @@ | ||
|
||
Boogie 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix Dafny to Boogie translation of FunctionHandles |
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 |
---|---|---|
|
@@ -13,6 +13,12 @@ | |
"commands": [ | ||
"dotnet-format" | ||
] | ||
}, | ||
"boogie": { | ||
"version": "2.15.9", | ||
"commands": [ | ||
"boogie" | ||
] | ||
} | ||
} | ||
} |