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

Flag for SyntaxValueProvider.ForAttributeWithMetadataName to respect attribute inheritance #76834

Open
zotanmew opened this issue Jan 21, 2025 · 2 comments
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@zotanmew
Copy link

Assuming it's possible to check for inherited (e.g. [AttributeUsage(AttributeTargets.Class, Inherited = true)]) attributes in the ForAttributeWithMetadataName algorithm without breaking the incremental aspect, would it be possible to get a flag for the ForAttributeWithMetadataName method to enable this behavior (at least for the immediate parent)?

This would be very useful for scenarios where e.g. a class library ships an abstract class with a virtual method whose implementation needs to be generated based on the content of the respective inherited class.

If this is not possible, is there a way to group a IncrementalValueProvider's results without breaking the incremental aspect? The only way I've found to do this is by calling .Collect() and doing the grouping in the RegisterSourceOutput action, which is significantly less efficient.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 21, 2025
@CyrusNajmabadi
Copy link
Member

Assuming it's possible to check for inherited (e.g. [AttributeUsage(AttributeTargets.Class, Inherited = true)]) attributes in the ForAttributeWithMetadataName algorithm without breaking the incremental aspect

It is not possible to do this.

and doing the grouping in the RegisterSourceOutput action, which is significantly less efficient.

What is less efficient about this?

@zotanmew
Copy link
Author

It is not possible to do this.
That's unfortunate, thank you regardless!

What is less efficient about this?
It causes all output files to be regenerated when any matching inputs are modified, instead of only regenerating the modified group.

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
Projects
None yet
Development

No branches or pull requests

2 participants