-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
BadErrorMessageIssues related compiler error messages that should be better.Issues related compiler error messages that should be better.BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
I was poking around in the type checker and discovered this:
type t[p any] struct {
f p
}
type a t[a]
Which yields:
./prog.go:7:6: invalid recursive type a
./prog.go:7:6: a refers to t
./prog.go:7:8: t refers to a
Which seems a bit confusing as t
is generic and makes no reference to a
in its definition. I would have expected t[a]
refers to a
and such.
If we make the type argument an alias, we also do not mention the alias:
type t[p any] struct {
f p
}
type b = a
type a t[b]
./prog.go:8:6: invalid recursive type a
./prog.go:8:6: a refers to t
./prog.go:8:8: t refers to a
I would have expected a t[b] refers to b
and b
refers to a
.
Metadata
Metadata
Assignees
Labels
BadErrorMessageIssues related compiler error messages that should be better.Issues related compiler error messages that should be better.BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.