Actor source generator does not copy generic constraints for type parameters
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 378
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 6
Description
## Expected Behavior
Given the following actor interface:
```csharp
using Dapr.Actors.Generators;
using System.Threading.Tasks;
namespace Test
{
public interface ITrait
{
string GetName();
}
[GenerateActorClient]
public interface ITestActor where TTrait : ITrait
{
Task SetTrait(TTrait trait);
Task GetTrait(string name);
}
}
```
it should generate a class definition like this:
```csharp
public sealed class TestActorClient : Test.ITestActor where TTrait : Test.ITrait
...
```
## Actual Behavior
instead, it generates this:
```csharp
public sealed class TestActorClient : Test.ITestActor
...
```
The constraints are not copied.
## Steps to Reproduce the Problem
Use the DAPR source generator package with the above actor interface, then examine the analyzer output (or try to compile it.) It will fail.
## Release Note
RELEASE NOTE:
Contributor guide
Research direction
Start with the Dapr source generator package and reproduce the issue using the generic actor interface shown in the report. Inspect the analyzer output and compile the generated client; done means the generated class preserves the type parameter constraint and the example builds successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100