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

Make from in TokenList.slice(from, to) inclusive #516

Closed
marcelocenerine opened this issue Dec 19, 2017 · 0 comments
Closed

Make from in TokenList.slice(from, to) inclusive #516

marcelocenerine opened this issue Dec 19, 2017 · 0 comments

Comments

@marcelocenerine
Copy link
Contributor

TokenList.slice(from, to) doesn't have the same behavior as slice in the Scala's std collection. This is due to the fact that the from parameter is exclusive. This is something that rule authors may not expect and can be the cause of bugs for those not familiar with the implementation details of TokenList.

The current behavior also affects usability. For instance, while removing tokens what could take a single step (ctx.removeTokens(tokenList.slice(tk, last)) actually requires 2 (ctx.removeToken(tk) + ctx.removeTokens(tokenList.slice(tk, last)).

See https://github.com/scalacenter/scalafix/pull/474/files#r157779985

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

No branches or pull requests

1 participant