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

types2, go/types: self-referential type parameter list is not accepted #47796

Closed
griesemer opened this issue Aug 18, 2021 · 3 comments
Closed
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@griesemer
Copy link
Contributor

Example:

package p
type Eq[a Eq[a]] interface {
	Equal(that a) bool
}

produces

:2:13: Eq is not a generic type

Should this be permitted?

cc: @ianlancetaylor

@griesemer griesemer added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Aug 18, 2021
@griesemer griesemer added this to the Go1.18 milestone Aug 18, 2021
@griesemer griesemer self-assigned this Aug 18, 2021
@griesemer
Copy link
Contributor Author

In any case, the error message needs to be fixed. Eq is a generic type.

@ianlancetaylor
Copy link
Contributor

I can't think of a reason to forbid this. It seems well-defined. It would be more problematic in a function definition, where we would have to derive an operation set, but of course this can't happen in a function definition and the problem doesn't arise in a type definition.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/348090 mentions this issue: cmd/compile/internal/types2: handle recursive type parameter constraints

@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

3 participants