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

Add fixer to convert from bound generic types in nameof to unbound types. #75976

Merged
merged 66 commits into from
Nov 21, 2024

Conversation

CyrusNajmabadi
Copy link
Member

Followup to #75368. Adds an analyzer/fixer to move to the new simpler form.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 19, 2024
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review November 19, 2024 22:09
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner November 19, 2024 22:09
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to compiler (single file Traits.cs in tests) LGTM Thanks (iteration 59)

var ideDiagnosticIds = typeof(IDEDiagnosticIds).GetFields().Select(f => f.GetValue(f) as string).ToArray();
var unsupportedDiagnosticIds = ideDiagnosticIds.Except(supportedDiagnostics).ToArray();

Assert.Equal(numberOfUnsupportedDiagnosticIds, unsupportedDiagnosticIds.Length);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part of hte test has never been helpful. and every time we add an analyzer/fixer it fails and all we do is increment those numbers. so i'm deleting.

@CyrusNajmabadi
Copy link
Member Author

@ToddGrun ptal.

@@ -171,7 +171,7 @@ public void TestGettingCodeStyleSettingsProviderLanguageServiceAsync()
var optionsWithUI = CSharpCodeStyleOptions.EditorConfigOptions
.Remove(CSharpCodeStyleOptions.PreferredModifierOrder);

AssertEx.SetEqual(optionsWithUI, dataSnapShot.Select(setting => setting.Key.Option));
AssertEx.SetEqual(optionsWithUI.OrderBy(o => o.Name), dataSnapShot.Select(setting => setting.Key.Option).OrderBy(o => o.Name));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetEqual

Why is the ordering necessary for SetEqual?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that when they differ, the diff you get isn't awful. Basically, the diff function does things linearly, which makes for awful adds/removes/moves :-)


foreach (var typeArgumentList in invocation.DescendantNodesAndSelf().OfType<TypeArgumentListSyntax>())
{
foreach (var argument in typeArgumentList.Arguments)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

foreach (var argument in typeArgumentList.Arguments)

nit: since argument isn't used except for the filtering, might be nicer to use Any:

if (typeArgumentList.Any(static argument => argument.Kind() != SyntaxKind.OmittedTypeArgument))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I'm ok with this.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants