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

Projected string slices are shortcut #69

Closed
springcomp opened this issue May 1, 2023 · 0 comments · Fixed by #76
Closed

Projected string slices are shortcut #69

springcomp opened this issue May 1, 2023 · 0 comments · Fixed by #76

Comments

@springcomp
Copy link
Contributor

See jmespath.test#32

Currently, string slices are implemented using the projection mechanism.
However, the second hand of the projection is not evaluated when slicing a string.

As a result, the following expression does not evaluate correctly:

  • 'foo'[::-1].length(@) -> "oof"

Instead, it should yield the following result:

  • 'foo'[::-1].length(@) -> 3
springcomp added a commit that referenced this issue Jun 21, 2023
springcomp added a commit that referenced this issue Oct 27, 2024
springcomp added a commit that referenced this issue Jan 14, 2025
springcomp added a commit that referenced this issue Jan 14, 2025
* Fixes #69 - evaluate rhs after string slices

Signed-off-by: Springcomp <[email protected]>

* Added unit-test

Signed-off-by: Springcomp <[email protected]>

* Updated linter settings

Signed-off-by: Springcomp <[email protected]>

* Added unit-test for failing case

Signed-off-by: Springcomp <[email protected]>

* gofumpt

Signed-off-by: Springcomp <[email protected]>

---------

Signed-off-by: Springcomp <[email protected]>
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 a pull request may close this issue.

1 participant