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

Range mutator #2922

Open
richardwerkman opened this issue Apr 26, 2024 · 3 comments
Open

Range mutator #2922

richardwerkman opened this issue Apr 26, 2024 · 3 comments
Labels
Area: Mutator new mutators or change to existing one 🚀 Feature request New feature or request

Comments

@richardwerkman
Copy link
Member

Is your feature request related to a problem? Please describe.
Range operator expressions are not mutated at the moment. Even though this contains crucial logic sometimes.

Describe the solution you'd like

Original Mutated
.. 0
..end ..
..3 ..2
..3 ..4
start.. ..
2.. 1..
2.. 3..
start..end ..
2..2 1..2
2..2 3..2
2..2 2..1
2..2 2..3
^start.. ..
^2.. ^1..
^2.. ^3..
..^end ..
..^2 ..^1
..^2 ..^3
start..^end ..
2..^2 1..^2
2..^2 3..^2
2..^2 2..^1
2..^2 2..^3
^start..^end ..
^2..^2 ^3..^2
^2..^2 ^2..^1

So basically always replace with .. and if the start or end value is a declared value, increase this by one and decrease by one (check for bounds).

Additional context
See: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/member-access-operators#range-operator-

@richardwerkman richardwerkman added the 🚀 Feature request New feature or request label Apr 26, 2024
@rouke-broersma
Copy link
Member

Not sure we should implement the edge increase/decrease mutations, we don't do this for any other mutator either.

@richardwerkman
Copy link
Member Author

We could also add/remove the ^? Would that make more sense?

@dupdob
Copy link
Member

dupdob commented Apr 26, 2024

I do not think removing the 'relative to end' marker would create more interesting mutation than increment/decrement.
On an implementation note, while the mutation seems simple to generate, controlling them will be a bit more difficult: I am not sure we can use a ternary operator with a range expression.
but it should be a matter of adding a range expression orchestrator then

@dupdob dupdob added the Area: Mutator new mutators or change to existing one label Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Mutator new mutators or change to existing one 🚀 Feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants