Skip to content
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

feat(corelib): range IndexView #6971

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cairoIover
Copy link
Contributor

Adds IndexView to Array and Span, enabling the following syntax:
assert_eq!(arr[2_usize..4] == [3, 4].span());

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

@cairoIover cairoIover left a 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 2 files reviewed, 1 unresolved discussion


corelib/src/test/array_test.cairo line 15 at r1 (raw file):

fn test_array_out_of_bound_1() {
    let arr = array![10, 11, 12];
    arr[3_usize];

@orizi there's an issue with type inference that forced me to specify that this index is a usize. Would you be able to TAL?

Code quote:

    arr[3_usize];

Copy link
Collaborator

@orizi orizi left a 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 2 files reviewed, 1 unresolved discussion (waiting on @cairoIover and @orizi)


corelib/src/test/array_test.cairo line 15 at r1 (raw file):

Previously, cairoIover wrote…

@orizi there's an issue with type inference that forced me to specify that this index is a usize. Would you be able to TAL?

this is the first instance where we have 2 options for an Index index type - we need to find the exact culprit.

I'd postpone this PR now - as .slice(...) already exists.

Copy link
Contributor Author

@cairoIover cairoIover left a 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 2 files reviewed, 1 unresolved discussion (waiting on @orizi)


corelib/src/test/array_test.cairo line 15 at r1 (raw file):

Previously, orizi wrote…

this is the first instance where we have 2 options for an Index index type - we need to find the exact culprit.

I'd postpone this PR now - as .slice(...) already exists.

Sure - I'll keep this open until then. Just so that I know is it something you plan on investigating in the near future?

Copy link
Collaborator

@orizi orizi left a 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 2 files reviewed, 1 unresolved discussion (waiting on @cairoIover and @orizi)


corelib/src/test/array_test.cairo line 15 at r1 (raw file):

Previously, cairoIover wrote…

Sure - I'll keep this open until then. Just so that I know is it something you plan on investigating in the near future?

i hope to.
but i'm yet to be sure we will have a proper solution any time soon (because it really depends on the exact cause of the problem)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants