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: allow negative index/end on std.slice #1093

Merged
merged 3 commits into from
Mar 2, 2024

Commits on Mar 2, 2024

  1. Configuration menu
    Copy the full SHA
    e2e995a View commit details
    Browse the repository at this point in the history
  2. Clamp negative slice start range to prevent out-of-range, and update …

    …fmt test golden
    
    Slice is documented to behave similarly to Python. Negative indexes in
    Python slices are clamped so slice indexes never produce out-of-range
    runtime errors. Update the 'slice' sugar to do the same.
    
    Note that only the starting index needs to be clamped in this way; the
    ending index can be out-of-range doesn't cause an error, as the loop
    exit condition compares the current index against the ending index.
    johnbartholomew committed Mar 2, 2024
    Configuration menu
    Copy the full SHA
    422af98 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8c53f3c View commit details
    Browse the repository at this point in the history