go/types, types2: missing error for invalid cycle in function declaration #43215
The following invalid cycle is currently detected by the compiler with the error "typechecking loop involving f".
However no error is detected by go/types, both at master and in the
The text was updated successfully, but these errors were encountered:
I don't believe this is a bug, and certainly not a release blocker. The spec says:
The size of a variable of function type is independent of the function type and always the same, so arguably this is valid code.
The spec also doesn't explicitly disallow it.
Interestingly, we do get a bug (initialization cycle) for this code:
package p import "unsafe" var f func([unsafe.Sizeof(f)]int)
which is not an initialization cycle (there is no initialization expression). Again, this shouldn't be a problem for the compiler/type-checker either. In any case, these are not release-blockers.