Skip to content

Conversation

@usagi32
Copy link
Contributor

@usagi32 usagi32 commented Oct 1, 2025

Motivation

closes #28855

Changes

  • Needed to change the grammar a little bit to be able to parse slice operators like rust i.e. arr[..], arr[1..=2] etc.
  • Added Slice Expression that resolves to a normal array expression till const proprogation. The resulting array will be a copied subset of the original expression.

Maybe this could have been by adding references, range types and dynamically sized types, but for now, this should do.

Test Plan

  • Added new tests.
  • Rest should be taken care of by the CI.

@d0cd
Copy link
Collaborator

d0cd commented Oct 1, 2025

@usagi32 I like your approach to array slicing over my own! Specifically, that it is handled in constant propagation rather than code generation.

Would you be up for rebasing this PR onto this one: #28869?

@usagi32
Copy link
Contributor Author

usagi32 commented Oct 2, 2025

Sure

@usagi32
Copy link
Contributor Author

usagi32 commented Oct 7, 2025

@d0cd just did something. You can have a look.

@mohammadfawaz mohammadfawaz changed the base branch from mainnet to feat/array-slicing October 10, 2025 00:20
@mohammadfawaz mohammadfawaz changed the base branch from feat/array-slicing to mainnet October 10, 2025 00:20
@mohammadfawaz
Copy link
Collaborator

@d0cd just did something. You can have a look.

Is this now rebased on top onto #28869? If so, you may want to change the base branch and convert it to a draft until the #28869 is approved and merged.

@d0cd d0cd changed the base branch from mainnet to feat/array-slicing October 16, 2025 12:30
@d0cd d0cd changed the base branch from feat/array-slicing to mainnet October 16, 2025 12:30
@d0cd d0cd changed the base branch from mainnet to feat/array-slicing October 16, 2025 22:41
@d0cd
Copy link
Collaborator

d0cd commented Oct 16, 2025

@usagi32 thanks for making the changes! I had to refresh feat/array-slicing so that the diff from this branch wasn't so large. Just a few conflicts left and we're good to go.

@usagi32 usagi32 changed the base branch from feat/array-slicing to mainnet November 4, 2025 18:53
@usagi32
Copy link
Contributor Author

usagi32 commented Nov 4, 2025

@d0cd done

@d0cd d0cd changed the base branch from master to feat/array-slicing January 10, 2026 03:28
@d0cd d0cd changed the base branch from feat/array-slicing to master January 10, 2026 03:28
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.

[Feature] Leo array slicing.

3 participants