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.
I was doing a bit of testing with regards to cycles through instantiated types. If we type check the below:
We get the below error message:
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 ofbto the below solves both errors.I think it's reasonable to remove the second error here.