Support non-basic type constraints
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 135
- Avg merge
- 11d 6h
- Merged PRs (30d)
- 1
Description
This issue is to track the limitation that was mentioned in the description of #175.
Consider the following interface:
```go
type Sorter[T comparable] interface {
Sort(slice []T) []T
}
```
When generating a mock using moq v0.3.2, the following implementation check is created:
```go
var _ Sorter[comparable] = &SorterMock[comparable]{}
```
This code is not valid due to the following reason:
> cannot use type comparable outside a type constraint: interface is (or embeds) comparable
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the Sorter[T comparable] interface shown in the report and inspect the code-generation path that emits the implementation check. Done means the generated mock for this non-basic constraint compiles without producing Sorter[comparable] in an invalid context; add or run a regression test if the repository has an appropriate generator test entry point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100