| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
| if ( | ||
| isinstance(base.type, RTuple) | ||
| and isinstance(folded_index := constant_fold_expr(builder, index), int) | ||
| and folded_index >= 0 |
There was a problem hiding this comment.
Check for index overflow (it may generate an error elsewhere, but we don't want to crash the compiler if it's ignored).
Sorry, something went wrong.
There was a problem hiding this comment.
Done.
I also just thought about reverse indexing, I'll implement that too
Sorry, something went wrong.
There was a problem hiding this comment.
We will need to adapt TupleGet before we can pass negative values here.
I've implemented that in a separate PR #19990 , lets pause this one until we get that merged in so we don't have to come back to this section later
Sorry, something went wrong.
maybe I should just compute the correct positive index value when we encounter a negative index, rather than doing this? Where's the best place to do that? Should that be with this or in a separate PR?
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
This PR modifies `TupleGet.__init__` to automatically convert negative indexes to positive indexes instead of crashing at the assert This won't change functionality on its own, but will allow us to pass negative values in python#19972 so I think we should consider this PR a prerequisite to that one
This PR modifies `TupleGet.__init__` to automatically convert negative indexes to positive indexes instead of crashing at the assert This won't change functionality on its own, since none of the existing calling locations can pass a negative value, but will allow us to pass negative values in python#19972 so I think we should consider this PR a prerequisite to that one
This PR modifies `TupleGet.__init__` to automatically convert negative indexes to positive indexes instead of crashing at the assert This won't change functionality on its own, since none of the existing calling locations can pass a negative value, but will allow us to pass negative values in #19972 so I think we should consider this PR a prerequisite to that one --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Piotr Sawicki <sawickipiotr@outlook.com>
|
Now that #19990 is merged, this PR is ready for review. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR attempts to constant fold the index value in translate_index_expr
I'm not sure any test changes are warranted for a small PR of this nature.