-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Legacy module names option (#5679)
### Description Similar to the previously added `--legacy-data-constructors` option, `--legacy-module-names` outputs module names in the scheme `A_mB_mC`, as previous versions of Dafny did, instead of `A.B.C`, in the name of backwards compatibility with other Dafny-generated consumers. ### How has this been tested? Updated `comp/separate-compilation/usesTimesTwo-oldDafnyCompatibility.dfy` to use a nested library module name, and therefore test both `--legacy-data-constructors` and `--legacy-module-names`.
- Loading branch information
Showing
6 changed files
with
50 additions
and
23 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
29 changes: 18 additions & 11 deletions
29
...onTests/TestFiles/LitTests/LitTest/comp/separate-compilation/Inputs/producer/timesTwo.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,18 +1,25 @@ | ||
module {:options "--function-syntax:4"} LibraryModule { | ||
module {:options "--function-syntax:4"} CoolLibraryName { | ||
|
||
function TimesTwo(x: nat): nat | ||
{ | ||
x * 2 | ||
} | ||
// Ensuring this module is not empty, | ||
// or else it will be omitted from the translation record. | ||
const FOO := 42 | ||
|
||
module LibraryModule { | ||
|
||
datatype Result<+T, +E> = Success(value: T) | Failure(error: E) | ||
function TimesTwo(x: nat): nat | ||
{ | ||
x * 2 | ||
} | ||
|
||
// Record type | ||
datatype Pair<+T, +U> = Pair(first: T, second: U) | ||
datatype Result<+T, +E> = Success(value: T) | Failure(error: E) | ||
|
||
datatype NestedTypeConstructorRecord<+T> = First(value: Pair<T, T>) | ||
datatype NestedTypeConstructorClass<+T> = First2(value: Pair<T, T>) | Second2(value: Pair<T, T>) | ||
// Record type | ||
datatype Pair<+T, +U> = Pair(first: T, second: U) | ||
|
||
datatype NoTypeArgs = Success2 | Failure2 | ||
datatype NestedTypeConstructorRecord<+T> = First(value: Pair<T, T>) | ||
datatype NestedTypeConstructorClass<+T> = First2(value: Pair<T, T>) | Second2(value: Pair<T, T>) | ||
|
||
datatype NoTypeArgs = Success2 | Failure2 | ||
|
||
} | ||
} |
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