Default value adt fixes#1384
Draft
lorchrob wants to merge 6 commits into
Draft
Conversation
This file contains hidden or 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
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.
Two bug fixes
First, a straightforward bug fix in
default_valueinlustreDesugarADTs.mlSecond ---
Say we have
t = C(0), andt' = C(0), buttandt'have different junk fields. Say we have sets. When determiningt in sort' in s, clearly only the non-junk fields should be considered. But, our encoding is a mapping from all the fields to a boolean value. So, in my opinion, the cleanest thing to do is to canonicalize junk fields to a default value -- when compilingt in sfor ADT expressiont, we essentially computes[t_tag][canonicalize(t_field0)][canonicalize(t_field1)]..., where canonicalize is just an ITE:if constructor_selected then t_fieldn else default_value. Then clearly, we have to also update set insertion analogously.To be clear, what we were doing before this PR is
s[t_tag][t_field0][t_field1]..., the same thing but without thecanonicalizeITE