-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[move-enums] Add mut
in patterns for mutable bindings
#15795
Merged
tzakian
merged 3 commits into
cgswords/compiler_enums_no_bytecode
from
tzakian/mut_patterns
Feb 5, 2024
Merged
[move-enums] Add mut
in patterns for mutable bindings
#15795
tzakian
merged 3 commits into
cgswords/compiler_enums_no_bytecode
from
tzakian/mut_patterns
Feb 5, 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 latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
cgswords
reviewed
Jan 22, 2024
external-crates/move/crates/move-compiler/tests/move_2024/parser/invalid_mut_usage_match.exp
Outdated
Show resolved
Hide resolved
cgswords
reviewed
Jan 22, 2024
...al-crates/move/crates/move-compiler/tests/move_2024/expansion/or_pat_mutability_mismatch.exp
Outdated
Show resolved
Hide resolved
cgswords
reviewed
Jan 22, 2024
cgswords
reviewed
Jan 22, 2024
external-crates/move/crates/move-compiler/src/expansion/translate.rs
Outdated
Show resolved
Hide resolved
cgswords
reviewed
Jan 22, 2024
cgswords
requested changes
Jan 22, 2024
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.
Some smalll nits about error messages, but looks good to me.
A few more tests might be nice, too.
cgswords
force-pushed
the
cgswords/compiler_enums
branch
3 times, most recently
from
January 23, 2024 05:18
7fd460b
to
1783e03
Compare
tzakian
force-pushed
the
tzakian/mut_patterns
branch
from
January 23, 2024 18:04
bcc466c
to
0a7ca5f
Compare
tzakian
force-pushed
the
tzakian/mut_patterns
branch
from
January 23, 2024 20:52
0a7ca5f
to
cba8336
Compare
tzakian
force-pushed
the
tzakian/mut_patterns
branch
from
January 23, 2024 22:31
cba8336
to
40006ce
Compare
tzakian
force-pushed
the
cgswords/compiler_enums
branch
from
January 24, 2024 23:02
1783e03
to
7d8f642
Compare
## Description Add support for ellipsis patterns in both enum and struct patterns. Ellipsis patterns are supported in both named and positional patterns. 1. Only one ellipsis pattern may be present (both in positional and named patterns). 2. An ellipsis pattern corresponds to zero or more arguments. 3. Ellipsis patterns are only valid as field patterns, and cannot occur as a top-level pattern. Some examples of valid patterns (for both struct and enum variant patterns): ``` C(..) C(x, ..) C(x, .., y) C(.., x) N { x, .. } N { x, y, .. } N { .., x } N { .. } ``` Some invalid patterns: ``` C(.., ..) C(x, .., y, ..) C(..) // if C is a named variant or does not have any parameters N { .., .. } N { .. } // If N is a positional/empty variant ``` ## Test Plan Added additional positive and negative tests. --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
tzakian
force-pushed
the
tzakian/mut_patterns
branch
from
February 5, 2024 22:30
7fd8cd1
to
d1c1ba9
Compare
tzakian
requested review from
a team,
lanvidr,
patrickkuo,
kchalkias and
benr-ml
as code owners
February 5, 2024 22:30
tzakian
requested review from
Nikhil-Mysten and
hayes-mysten
and removed request for
a team
February 5, 2024 22:30
github-actions
bot
added
the
Type: Documentation
Improvements or additions to documentation
label
Feb 5, 2024
tzakian
changed the base branch from
cgswords/compiler_enums
to
cgswords/compiler_enums_no_bytecode
February 5, 2024 22:31
tzakian
removed request for
a team,
lanvidr,
patrickkuo,
kchalkias,
benr-ml,
Nikhil-Mysten and
hayes-mysten
February 5, 2024 22:31
cgswords
pushed a commit
that referenced
this pull request
Feb 7, 2024
Adds `mut` to enum patterns. * A `mut` modifier is required on a variable that is modified on the RHS (same rules as `let mut`. * `mut` is only allowed in front of variable binders in patterns (and field names if punning in the pattern). * Binders across or-patterns must have the same mutability Added new tests --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration
cgswords
pushed a commit
that referenced
this pull request
Feb 7, 2024
Adds `mut` to enum patterns. * A `mut` modifier is required on a variable that is modified on the RHS (same rules as `let mut`. * `mut` is only allowed in front of variable binders in patterns (and field names if punning in the pattern). * Binders across or-patterns must have the same mutability Added new tests --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration
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.
Description
Adds
mut
to enum patterns.mut
modifier is required on a variable that is modified on the RHS (same rules aslet mut
.mut
is only allowed in front of variable binders in patterns (and field names if punning in the pattern).Test Plan
Added new tests
If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section.
Type of Change (Check all that apply)
Release notes