-
Notifications
You must be signed in to change notification settings - Fork 291
Only check for incomplete element orderings on top-level-bindings #6035
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
Conversation
| Constructors cs -> | ||
| -- Should constructors be considered top-level? | ||
| let (hashes, _) = hashCycle cs | ||
| in tag 2 : map hashed hashes |
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.
@aryairani Do I need to consider constructors as top-level? I think so, since constructor re-orderings would be problematic when there are external references in.
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.
I don't think constructors can be part of cycles so I don't think it matters? Or am I forgetting something?
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.
I'm gonna merge it for now, but we can discuss soon
29af5ce to
1f4b70d
Compare
Overview
in #6007 I introduced checks to prevent creation of certain classes of problematic components for which there were multiple possible components for the same hash;
However in doing so, it also triggered failures where valid definitions contained structurally equivalent letrec-bindings
This change makes it so we only trigger the error on top-level bindings, not internal let-recs.
See https://www.notion.so/unisonweb/Cycle-Hashing-Issue-2bf5fbdd830d80c8b2ffe821c0f8638a?showMoveTo=true&saveParent=true for some more internal notes on the issue.
Implementation approach and notes
The original plan was to use
IsTopfrom the ABT Term Functor to determine whether we were hashing the top-level cycle, however this didn't work in all cases because the V2 Term Functor doesn't have an IsTop, and adding one would affect the serialization format which is no good;Instead I added an argument to
doHashCycleforisTop, and set it to true on the initial call tohashComponentsand False when we recurse.I'm not 100% positive of the behaviour here, but it does seem to be working as expected in tests.
Test coverage