-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow type parameters on newtypes #5495
Merged
RustanLeino
merged 102 commits into
dafny-lang:master
from
RustanLeino:newtype-type-params
Aug 28, 2024
Merged
feat: Allow type parameters on newtypes #5495
RustanLeino
merged 102 commits into
dafny-lang:master
from
RustanLeino:newtype-type-params
Aug 28, 2024
Conversation
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
The generated SMT is different than before, because of the soundness fix that removes the `where` clause of the well-formedness check of subset/new-types.
# Conflicts: # Source/DafnyCore/Resolver/PreType/PreTypeResolve.Expressions.cs
# Conflicts: # Source/DafnyCore/AST/Grammar/Printer/Printer.cs # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/PrettyPrinting.dfy # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/PrettyPrinting.dfy.expect
# Conflicts: # Source/DafnyCore/Verifier/BoogieGenerator.Types.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved pending resolution of TODO in Combine()
ssomayyajula
previously approved these changes
Aug 26, 2024
Variance does not need to be considered here, because type parameters with non-co variance that should be excluded from these type-refinement flows have already been marked as such (by omitting the bottom wrapper in `PreType2RefinableType`).
ssomayyajula
approved these changes
Aug 26, 2024
dnezam
pushed a commit
to dnezam/dafny
that referenced
this pull request
Aug 29, 2024
This PR adds the following language features: * type parameters of `newtype` declarations * optional `witness` clause of constraint-less `newtype` declarations * tool tips show auto-completed type parameters * tool tips show inferred `(==)` characteristics Along the way, the PR also fixes two previous soundness issues: * fix: Check the emptiness status of constraint-less `newtype` declarations (dafny-lang#5520) * fix: Don't let `newtype` well-formedness checking affect witness checking (dafny-lang#5521) Fixes dafny-lang#5520 Fixes dafny-lang#5521 <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>
dnezam
pushed a commit
to dnezam/dafny
that referenced
this pull request
Sep 21, 2024
This PR adds the following language features: * type parameters of `newtype` declarations * optional `witness` clause of constraint-less `newtype` declarations * tool tips show auto-completed type parameters * tool tips show inferred `(==)` characteristics Along the way, the PR also fixes two previous soundness issues: * fix: Check the emptiness status of constraint-less `newtype` declarations (dafny-lang#5520) * fix: Don't let `newtype` well-formedness checking affect witness checking (dafny-lang#5521) Fixes dafny-lang#5520 Fixes dafny-lang#5521 <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>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the following language features:
newtype
declarationswitness
clause of constraint-lessnewtype
declarations(==)
characteristicsIt also makes a breaking change in what's allowed in refinement modules, namely that a refinement module is no longer allowed to rename type parameters. Since comparisons during these refinement checks are done syntactically, it gets difficult to make sure the types in the refinement module really mean the same thing as in the original module. Having the ability to rename type parameters here does not seem like an important feature, so it was easier to just be more strict about it. (Note, there are some cases where type parameters can be renamed when going from a trait to a type that implements the trait. Those comparisons are done with semantic information, so they can be done reliably.)
Along the way, the PR also fixes two previous soundness issues:
newtype
declarations (Base type throws off witness checking #5520)newtype
well-formedness checking affect witness checking (Constraint-less newtypes assumed to be nonempty #5521)Fixes #5520
Fixes #5521
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.