-
Notifications
You must be signed in to change notification settings - Fork 549
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
Add int_range_try_new libfunc. #6288
Conversation
64103f0
to
e3e3115
Compare
a7707f6
to
95ccbe1
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: 0 of 6 files reviewed, 1 unresolved discussion (waiting on @orizi)
crates/cairo-lang-sierra/src/extensions/modules/range.rs
line 120 at r1 (raw file):
}, // Failure. BranchSignature {
I wonder if I should return the range [y, y]
in the failure branch. Currently, the high level code looks like:
match internal::range_try_new(self.start, self.end) {
Option::Some(range) => range,
Option::None => internal::range_try_new(self.end, self.end).unwrap(),
}
Note the unwrap()
which makes it panicable (unnecessarily).
The two ways to solve it (if we want to) are:
- Return the range
[y, y]
on failure. - Add another libfunc for constructing an empty range
[a, a]
(which never fails)
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: 0 of 6 files reviewed, 1 unresolved discussion (waiting on @liorgold2)
crates/cairo-lang-sierra/src/extensions/modules/range.rs
line 120 at r1 (raw file):
Previously, liorgold2 wrote…
I wonder if I should return the range
[y, y]
in the failure branch. Currently, the high level code looks like:match internal::range_try_new(self.start, self.end) { Option::Some(range) => range, Option::None => internal::range_try_new(self.end, self.end).unwrap(), }
Note the
unwrap()
which makes it panicable (unnecessarily).The two ways to solve it (if we want to) are:
- Return the range
[y, y]
on failure.- Add another libfunc for constructing an empty range
[a, a]
(which never fails)
making Range
constable
makes sense as well.
but returning it in the Result::Err
makes sense to me (as it actually costs nothing).
but if we add it as constable
we can than just (One::one(), One::one())
or something like it.
e3e3115
to
fa75e7f
Compare
95ccbe1
to
be1999d
Compare
fa75e7f
to
b90055d
Compare
be1999d
to
c392a11
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 4 of 5 files at r3, all commit messages.
Reviewable status: 4 of 6 files reviewed, 1 unresolved discussion (waiting on @liorgold2)
c392a11
to
d798244
Compare
b90055d
to
34e0a0b
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: 4 of 6 files reviewed, 1 unresolved discussion (waiting on @orizi)
crates/cairo-lang-sierra/src/extensions/modules/range.rs
line 120 at r1 (raw file):
Previously, orizi wrote…
making
Range
constable
makes sense as well.but returning it in the
Result::Err
makes sense to me (as it actually costs nothing).but if we add it as
constable
we can than just(One::one(), One::one())
or something like it.
I went with returning [y, y)
or failure as this is the simplest solution.
Done in another PR.
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 5 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @liorgold2)
commit-id:d8aa7059
34e0a0b
to
130a577
Compare
Stack:
This change is