-
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.
Milestone
Description
I was doing a bit of testing with regards to cycles through instantiated types. If we type check the below:
type a = b[int]
type b[_ any] = a
We get the below error message:
./prog.go:3:6: invalid recursive type a
./prog.go:3:6: a refers to b
./prog.go:4:6: b refers to a
./prog.go:3:10: cannot use generic type b[_ any] without instantiation
The first reported error seems reasonable, but the second seems like an erroneous follow-on error. From the user's perspective, the type has been instantiated (b[int]
) — it's a coincidence that a cycle error prevents said instantiation. Changing the definition of b
to the below solves both errors.
type a = b[int]
type b[_ any] = int
I think it's reasonable to remove the second error here.
scaventz
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.