Skip to content

Update simplify-type-names to understand global imports.#60872

Merged
CyrusNajmabadi merged 77 commits intodotnet:mainfrom
CyrusNajmabadi:simplifyTypeNamesGlobalImports
Apr 29, 2022
Merged

Update simplify-type-names to understand global imports.#60872
CyrusNajmabadi merged 77 commits intodotnet:mainfrom
CyrusNajmabadi:simplifyTypeNamesGlobalImports

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Apr 21, 2022

Fixes #59042

Followup to #59533.

@CyrusNajmabadi CyrusNajmabadi requested review from a team as code owners April 21, 2022 00:05
@ghost ghost added the Area-Compilers label Apr 21, 2022
@CyrusNajmabadi CyrusNajmabadi marked this pull request as draft April 21, 2022 00:06
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review April 28, 2022 20:02
private static ImmutableHashSet<string> GetAliasedNames(CompilationUnitSyntax? compilationUnit)
private ImmutableHashSet<string> GetAliasedNames(CompilationUnitSyntax compilationUnit)
{
var aliasedNames = s_emptyAliasedNames;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure the static makes sense any more. Could probably switch to a builder

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

agreed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed to pooled set.

}
}

foreach (var usingDirective in compilationUnit.Usings)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are these not already included because of the above? or does position 0 in GetImportScopes mean it only returns the global usings?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, this will pull in the other global usings, it doesn't pull in the usings for the using block we're in.

@CyrusNajmabadi CyrusNajmabadi merged commit 9748f55 into dotnet:main Apr 29, 2022
@ghost ghost added this to the Next milestone Apr 29, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the simplifyTypeNamesGlobalImports branch April 29, 2022 21:11
@Cosifne Cosifne modified the milestones: Next, 17.3 P2 May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDE does not offer name simplification for global using type aliases

3 participants