-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Lightbulb suggests renaming a type to "var" #2605
Comments
@lgolding Is this with VS 2015 RC? If not, what version of VS and Roslyn are you using? |
Yes, 2015 RC. 22822.1 IIRC, although I don't have it in front of me here on the bus :) Sorry, I included that information when I originally filed the bug in TFS, but forgot to mention it when I re-filed it in GitHub. Larry Sent from my Windows Phone From: Paul Harringtonmailto:[email protected] @lgoldinghttps://github.com/lgolding Is this with VS 2015 RC? If not, what version of VS and Roslyn are you using? — |
@lgolding Did you manually replace the type name with "var" by typing "var" (or pasting it or making some other edit), or did you run an automated fix that reduced the type name to "var" automatically? Some background: When a reference is tracked for rename, we usually show the dotted border around the identifier. But, once the identifier binds to something again (whether a different symbol or, in this case, the same symbol), the dotted border goes away because you're probably done with your edit. But, we continue to allow the rename to be executed just in case the user really wants to rename the original underlying symbol to a name already used by another symbol (probably introducing an ambiguity at the current reference, but that's their decision), or they really want to rename the underlying symbol to "var" in this case, since it would be a legal rename. There's a few things we could do here:
For now, I'd vote for either 4 (do nothing because it would be a legal rename) or 2 (special case "var" in Rename Tracking). |
Hi David, I manually edited the type name to var. This bug report is a false positive. I did not realize that “var” is a legal type namehttps://msdn.microsoft.com/en-us/library/bb384061(v=vs.140).aspx: “If a type named var is in scope, then the var keyword will resolve to that type name and will not be treated as part of an implicitly typed local variable declaration.” That said, I would still vote for #2 (“special case var”) because I think it's extremely unlikely that somebody who makes that particular edit really intended to rename their type to “var”, so almost always the user would see a lightbulb that does not help them. Thanks, |
I'm also in favor of just special casing |
Fixes dotnet#2605 "Lightbulb suggests renaming a type to 'var'" This change disables using Rename Tracking to rename to/from "var" and "dynamic" in C#.
Thanks David! Sent from my Windows Phone From: David Poeschlmailto:[email protected] Closed #2605#2605 via #2766#2766. — |
@lgolding No problem, thanks for reporting it! Can you take a look and verify that it works as expected in this case now and add the Verified label if so? I can find someone else to take a look if needed -- just assign the issue back to me if that's the case. |
@dpoeschl Taking you up on your offer to find someone else to verify this, thanks. |
Simple enough bug, verified myself. |
Screen shot says it all:
The text was updated successfully, but these errors were encountered: