go/types: better error message for "func f(f)" and similar declarations #25790
Labels
early-in-cycle
A change that should be done early in the 3 month dev cycle.
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
For
cmd/compile reports "f is not a type", but go/types (after https://go-review.googlesource.com/c/go/+/116815) reports: "illegal cycle in declaration of f", which is ok, but not as good.
The problem is that the new cycle detection code doesn't know that we're looking for a type. If it knew, it could avoid reporting the cycle in favor of the subsequent error. Fixing this will likely require that we pass around a "context" parameter during type-checking which states the expectation for the expression to be checked (similar to the "top" parameter in the compiler's type checker). Not hard to do but possibly pervasive.
The text was updated successfully, but these errors were encountered: