postsharp / Metalama

Metalama is a Roslyn-based meta-programming framework. Use this repo to report bugs or ask questions.
176 stars 5 forks source link

Feature request: Support generic aspect types (TypeAspect) #199

Open WhitWaldo opened 1 year ago

WhitWaldo commented 1 year ago

I have a need to apply generic constraints to a type passed into an aspect. This is because the type is used in downstream methods which themselves have such constraints.

This means that it's not sufficient to support the user simply passing in a type an argument because constraints cannot be declared there. This led earlier to several dozen build errors indicating that the constraints were not met for the type passed into all manner of generic type arguments which made sense in retrospect.

Moreover, one cannot reference instance members of an aspect in a BuildEligibility today in a way that would at least ensure that the aspect wasn't applied to an ineligible type, but I have asked for this in a separate issue.

Please support this scenario as I'm not seeing a means of otherwise specifying these constraints on an arbitrary Type passed into an aspect and used downstream.

Thank you!

PostSharpBot commented 1 year ago

Hello @WhitWaldo, thank you for submitting this issue. We will try to get back to you as soon as possible. Note to the PostSharp team, this ticket is being tracked in our dashboard under ID TP-33605.

gfraiteur commented 1 year ago

Well received. This is a complex endeavor so we are keeping that for all long-term backlog.