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

GivenAndUsing rule duplicates using keyword when explicitly passing a using param #30

Closed
mrdziuban opened this issue Oct 4, 2024 · 2 comments · Fixed by #31
Closed

Comments

@mrdziuban
Copy link
Contributor

mrdziuban commented Oct 4, 2024

Thank you for these rules, it makes the migration to new Scala 3 syntax a lot simpler!

I've found that the GivenAndUsing rule can produce invalid syntax when existing code is already passing a using param explicitly.

For example given this code:

def test(using i: Int): Int = i

test(using 1)

The GivenAndUsing rule rewrites it to this:

def test(using i: Int): Int = i

// Note duplicated `using` keyword here
test(using using 1)

I'm guessing something around here needs to check whether there's already a using keyword?

@ingarabr
Copy link
Contributor

ingarabr commented Oct 4, 2024

It's awesome that you found them useful and I'm happy that they're in use :-)

It looks like you're on to something where we need to add a guard against being a using (something like _.is[Mod.Using]). Could you look into it and create a PR for it?

@mrdziuban
Copy link
Contributor Author

Could you look into it and create a PR for it?

Sure thing, just opened #31

@hamnis hamnis closed this as completed in #31 Oct 8, 2024
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.

2 participants