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

Do not offer to convert typeof to nameof on a generic type #76920

Merged
merged 3 commits into from
Jan 24, 2025

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Jan 24, 2025

Fixes issue reported by partner.

Note: nested types are fine and still can be converted (and we have tests for this).

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner January 24, 2025 20:31
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 24, 2025
@CyrusNajmabadi CyrusNajmabadi changed the title DO not offer to convert typeof to nameof on a generic type Do not offer to convert typeof to nameof on a generic type Jan 24, 2025
// it's fine if an outer part of the name is generic (like `typeof(List<int>.Enumerator)`). as that will be
// convertible to `nameof(List<>.Enumerator)`. So we only need to check the type arguments directly on the type
// here, not on any containing types.
return namedType.TypeArguments.Length == 0;
Copy link
Member Author

Choose a reason for hiding this comment

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

note: we have tests for the non-generic nested in a generic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE 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.

3 participants