package p
type T int
func _() {
type GlobalT = T
type T int
var _ T = GlobalT(0)
}
produces:
x.go:8:12: incompatible type: cannot use GlobalT(0) (constant 0 of type T) as T value
The error message reports the same type (T) for the variable and the constant, which is confusing.
Maybe we can detect cases like these and provide additional information, such as where the types are declared.
Not urgent as this is a rare scenario.