Implement partial equivalence and extend forc migrate
tool
#6900
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.
Description
This PR:
core::ops
, as explained in detail in Partial equivalence #6883. The implementation is opt-in and behind thepartial_eq
experimental feature flag.forc migrate
migration steps for automatic migration topartial_eq
feature.forc migrate
migrations.Annotation
s onLexedModule
s in theLexedProgram
. (Those were before stripped off and not available in the compiledPrograms
. This resulted in loss off//!
doc-comments that are represented asdoc-comment
annotations.)Extensions in the
forc migrate
infrastructure include:cfg
attributes in code. This possibility is crucial for migrating our own codebase where we want to early-adopt and test and stabilize experimental features.cfg
attributes can remove parts of typed trees that might be needed in analysis.LexedLocate(As)Annotated
for easier location and retrieval ofAnnotated
elements.Modifier
s for modifying existing elements in the lexed tree.New
struct for convenient creation of often needed lexed tree elements. Note that we do not expect migrations to generate large new parts of lexed trees, but mostly to modify or copy and modify existing ones.Almost all of the changes in the Sway files are done automatically by the migration steps. The only manual change was in the
core
library (std
library is also automatically migrated) and in slight extension of two of the tests.Note that some of the tests have
Eq
traits in trait constraints. As explained in the #6883, it is not necessary to change those toPartialEq
. We might consider changing some of them, for testing purposes, and such a change is done on one of the tests that was testing the behavior of theEq
trait. But for the majority of the tests, there is no strict need for switching fromEq
toPartialEq
.Rolling
PartialEq
out in the tests provoked three existing issues that will be fixed in separate PRs: #6897, #6898, #6899.Checklist
Breaking*
orNew Feature
labels where relevant.