-
Notifications
You must be signed in to change notification settings - Fork 257
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
Datatype erasure and traits don't play together #5233
Labels
kind: bug
Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
part: code-generation
Support for transpiling Dafny to another language. If relevant, add a `lang:` tag
Comments
RustanLeino
added
kind: bug
Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
part: code-generation
Support for transpiling Dafny to another language. If relevant, add a `lang:` tag
labels
Mar 21, 2024
RustanLeino
added a commit
to RustanLeino/dafny
that referenced
this issue
Mar 21, 2024
Fixes dafny-lang#5233 As a bonus, allow the optimization when there are no _compiled_ fields (previously, the optimization was disabled when _any_ fields were present).
keyboardDrummer
pushed a commit
that referenced
this issue
Mar 22, 2024
…5234) This PR makes two changes to when the "erase datatype wrapper" optimization is engaged. * The optimization is disabled if the datatype implements any traits. (Previously, the optimization was still allowed under this condition, which had caused malformed code, see issue #5233.) * Allow the optimization in the presence of ghost fields. (Previously, the optimization was disabled if the datatype contained _any_ fields. But ghost fields pose no problems for compilation.) Fixes #5233 ### How has this been tested? The tests (including the test case from the bug report) were added to `comp/ErasableTypeWrappers.dfy`. <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>
RustanLeino
added a commit
to RustanLeino/dafny
that referenced
this issue
Jun 8, 2024
Fixes dafny-lang#5233 As a bonus, allow the optimization when there are no _compiled_ fields (previously, the optimization was disabled when _any_ fields were present).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
kind: bug
Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
part: code-generation
Support for transpiling Dafny to another language. If relevant, add a `lang:` tag
Dafny version
4.5.0
Code to produce this issue
Command to run and resulting output
What happened?
Since the datatype has 1 constructor with 1 argument, the compiler optimizes
Dt
to be just that argument. But this optimization should be used only if the datatype does not implement any traits.What type of operating system are you experiencing the problem on?
Mac
The text was updated successfully, but these errors were encountered: