flow-control: Add an if-based numeric match.#8130
Conversation
orizi
left a comment
There was a problem hiding this comment.
Reviewed 3 of 4 files at r1, all commit messages.
Reviewable status: 3 of 4 files reviewed, 3 unresolved discussions
crates/cairo-lang-lowering/src/lower/flow_control/create_graph/patterns.rs line 323 at r1 (raw file):
// Extract the literal value as `usize`. let Some(literal) = literal.value.to_usize() else { todo!();
what is the todo? check if unreachable? add diagnostic?
Code quote:
todo!();crates/cairo-lang-lowering/src/lower/flow_control/create_graph/patterns.rs line 334 at r1 (raw file):
} } _ => todo!(),
ditto.
Code quote:
_ => todo!(),crates/cairo-lang-lowering/src/lower/flow_control/test_data/match line 399 at r1 (raw file):
0 => 0, _ => 1, }
you plan to support this despite it not being contiguous? (so in this case - without 1 as one of the options)
Code quote:
match x {
2 | 4 => x,
0 => 0,
_ => 1,
}
810b876 to
c7d41a2
Compare
dd9f730 to
0222f09
Compare
c7d41a2 to
ceed3f7
Compare
liorgold2
left a comment
There was a problem hiding this comment.
Reviewable status: 3 of 4 files reviewed, 3 unresolved discussions (waiting on @orizi)
crates/cairo-lang-lowering/src/lower/flow_control/create_graph/patterns.rs line 323 at r1 (raw file):
Previously, orizi wrote…
what is the todo? check if unreachable? add diagnostic?
Sorry, I got lazy. Added a TODO comment.
crates/cairo-lang-lowering/src/lower/flow_control/create_graph/patterns.rs line 334 at r1 (raw file):
Previously, orizi wrote…
ditto.
Done
(Variable is unreachable, the rest should be diagnostics.)
crates/cairo-lang-lowering/src/lower/flow_control/test_data/match line 399 at r1 (raw file):
Previously, orizi wrote…
you plan to support this despite it not being contiguous? (so in this case - without
1as one of the options)
Yes, I don't see why not to support it.
commit-id:eaebd1fa
orizi
left a comment
There was a problem hiding this comment.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @liorgold2)
crates/cairo-lang-lowering/src/lower/flow_control/test_data/match line 399 at r1 (raw file):
Previously, liorgold2 wrote…
Yes, I don't see why not to support it.
my main concern is that non-consecutive match will be in efficient - but i guess this is lintable.
0222f09 to
1792553
Compare
liorgold2
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @liorgold2)
crates/cairo-lang-lowering/src/lower/flow_control/test_data/match line 399 at r1 (raw file):
Previously, orizi wrote…
my main concern is that non-consecutive match will be in efficient - but i guess this is lintable.
Yes, this should be checked in the linter, not be a restriction to the compilation.
Stack: