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

RS0046: Refactor call to 'LookupSymbols' to avoid name clash in arguments #3707

Open
Evangelink opened this issue Jun 3, 2020 · 4 comments

Comments

@Evangelink
Copy link
Member

Relates to #3352

I could not find which position to pass to the LookupSymbols call to avoid a name clash between the current parameter and the next.

public void M(string? sOpt, string? s) // How to ensure that the lookup for s returns the parameter?
{
}

See https://github.com/dotnet/roslyn-analyzers/pull/3352/files#diff-311b2f6fab1f2e00cefcbdf6e056dd96R202-R233

@Youssef1313
Copy link
Member

Youssef1313 commented Jun 4, 2020

Also related to: #3706 (have a call to LookupSymbols there too)

@Evangelink
Copy link
Member Author

@sharwell Sorry to ping you but would you have any idea on how to properly call the LookupSymbols to avoid the name clash that occurs on the example provided?

@Evangelink
Copy link
Member Author

@mavasani @sharwell We are stuck on this issue which seems to affect 2-3 analyzer, would it be possible for you to have a look or ping someone who could help here?

@sharwell
Copy link
Member

sharwell commented Dec 21, 2020

I'm not sure you'll be able to use LookupSymbols alone here, but if you can, I'm guessing you could pass the position right before the }. That location would see the parameters and all top-level locals, but would not see locals defined in nested scopes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants