fix panic when ..= syntax is used in stepped ranges#16231
Merged
sholderbach merged 3 commits intonushell:mainfrom Jul 30, 2025
sgvictorino:fix-range-panic
Merged
fix panic when ..= syntax is used in stepped ranges#16231sholderbach merged 3 commits intonushell:mainfrom sgvictorino:fix-range-panic
..= syntax is used in stepped ranges#16231sholderbach merged 3 commits intonushell:mainfrom
sgvictorino:fix-range-panic
Conversation
# Description Stepped range literals where `..=` precedes the second value no longer cause a parser panic: ``` > 1..=3.. == 1..3.. Error: x Main thread panicked. |-> at crates/nu-protocol/src/engine/state_working_set.rs:400:48 `-> slice index starts at 8 but ends at 7 ```
Member
|
Thanks for looking into this. I am personally not sure if we should support the equal sign ahead of the next position as well. I think |
..= syntax in stepped ranges..= syntax is used in stepped ranges
sholderbach
approved these changes
Jul 30, 2025
Member
sholderbach
left a comment
There was a problem hiding this comment.
Thanks for figuring this out!
The range parsing really breaks my mental model for parsing. Thanks for the tests!
I have thrown the fuzzer against your branch and so far haven't been able to unearth another range rambunctiousness :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16185
Description
Stepped range literals where
..=precedes the second value no longercause a parser panic:
Release notes summary
Stepped range literals where
..=precedes the second value no longer cause a parser panic. e.g:random int 1..=3..5