Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types, types2: error messages don't distinguish between different types with the same names #48295

griesemer opened this issue Sep 9, 2021 · 0 comments


Copy link

@griesemer griesemer commented Sep 9, 2021

package p

type T int

func _() {
	type GlobalT = T
	type T int
	var _ T = GlobalT(0)


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant