I don't know if there's much that can be done about this, but thought I'd mention it anyway.
Suppose you're trying to make a parameterised type, like
type Elem[T any] blah...
but you forget the "any", and just write
type Elem[T] blah...
The error message, and the automatic reformatting you get, is a bit confusing:
type Elem [T]blah...
undeclared name T for array length
I guess this is a fundamental ambiguity in the language. However, if an array length expression comes directly after a type name, and the array length itself consists of a single undeclared name, I wonder if the error message could give more of a hint?
undeclared name T for array length, or missing constraint for type parameter (e.g. "T any")
When there are multiple type parameters, it's fine: