-
Notifications
You must be signed in to change notification settings - Fork 602
Represent match arm wrapper as an enum with explicit cases #7726
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
a70f3d6
to
5dc04c5
Compare
1ff191a
to
a70375f
Compare
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.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @TomerStarkware)
crates/cairo-lang-lowering/src/lower/lower_match.rs
line 52 at r1 (raw file):
/// MatchArm wrapper that allows for: /// regular match patterns, else clause, and default (no else) clauses.
rephrase - the doc above should describe what is the meaning of the enum - description of the variants should be lest at the variants.
Code quote:
/// MatchArm wrapper that allows for:
/// regular match patterns, else clause, and default (no else) clauses.
crates/cairo-lang-lowering/src/lower/lower_match.rs
line 672 at r1 (raw file):
let pattern = pattern_path .pattern_index .map(|i| arms[pattern_path.arm_index].pattern(ctx, i).unwrap().clone());
Suggestion:
let pattern = pattern_path
.pattern_index
.and(|i| arms[pattern_path.arm_index].pattern(ctx, i).cloned());
a70375f
to
665219c
Compare
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.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @orizi and @TomerStarkware)
crates/cairo-lang-lowering/src/lower/lower_match.rs
line 52 at r1 (raw file):
Previously, orizi wrote…
rephrase - the doc above should describe what is the meaning of the enum - description of the variants should be lest at the variants.
Done.
crates/cairo-lang-lowering/src/lower/lower_match.rs
line 672 at r1 (raw file):
let pattern = pattern_path .pattern_index .map(|i| arms[pattern_path.arm_index].pattern(ctx, i).unwrap().clone());
I tried to preserve a compiler crash if we don't have a pattern when the index is available. That is, we previously found the pattern at this arm, but now it doesn't exist. Do we want to change that case to continue as if pattern is None?
665219c
to
a1236e5
Compare
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.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @eytan-starkware and @TomerStarkware)
crates/cairo-lang-lowering/src/lower/lower_match.rs
line 672 at r1 (raw file):
Previously, eytan-starkware wrote…
I tried to preserve a compiler crash if we don't have a pattern when the index is available. That is, we previously found the pattern at this arm, but now it doesn't exist. Do we want to change that case to continue as if pattern is None?
rather not have explicit unwraps - if you insist - add an expect
.
a1236e5
to
3551540
Compare
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.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @eytan-starkware and @TomerStarkware)
3551540
to
6b0e569
Compare
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.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @orizi and @TomerStarkware)
crates/cairo-lang-lowering/src/lower/lower_match.rs
line 672 at r1 (raw file):
Previously, orizi wrote…
rather not have explicit unwraps - if you insist - add an
expect
.
Done.
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.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)
5dc04c5
to
a9f55cf
Compare
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.
Reviewed all commit messages.
Reviewable status: 3 of 4 files reviewed, all discussions resolved (waiting on @orizi)
commit-id:415bf8b4
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.
Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @eytan-starkware)
6b0e569
to
fdd0a43
Compare
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.
Reviewed 2 of 2 files at r7, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @eytan-starkware)
Stack: