forked from dafny-lang/dafny
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not crash when required parameters occur after optional ones (dafn…
…y-lang#5074) Fixes dafny-lang#4809 ### Description Do not crash when required parameters occur after optional ones ### How has this been tested? Added a littish test <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
af84d77
commit be07874
Showing
7 changed files
with
18 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
7 changes: 7 additions & 0 deletions
7
Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/defaultParameterResolution.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,7 @@ | ||
// RUN: %testDafnyForEachResolver "%s" --expect-exit-code=2 | ||
|
||
function SumFromTo(sequence: nat -> real, start: nat := 0, end: nat): real | ||
|
||
function PartialSums(sequence: nat -> real): nat -> real { | ||
(n: nat) => SumFromTo(sequence, n) | ||
} |
2 changes: 2 additions & 0 deletions
2
Source/IntegrationTests/TestFiles/LitTests/LitTest/ast/defaultParameterResolution.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 @@ | ||
defaultParameterResolution.dfy(6,23): Error: function parameter 'end' at index 2 requires an argument of type nat | ||
1 resolution/type errors detected in defaultParameterResolution.dfy |
3 changes: 3 additions & 0 deletions
3
...grationTests/TestFiles/LitTests/LitTest/ast/defaultParameterResolution.dfy.refresh.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,3 @@ | ||
defaultParameterResolution.dfy(3,59): Error: a required parameter must precede all optional parameters | ||
defaultParameterResolution.dfy(6,23): Error: function parameter 'end' at index 2 requires an argument of type nat | ||
2 resolution/type errors detected in defaultParameterResolution.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dafny no longer crashes when required parameters occur after optional ones. |