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

Open
griesemer opened this issue Sep 9, 2021 · 0 comments
Assignees
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@griesemer
Copy link
Contributor

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.

@griesemer griesemer added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 9, 2021
@griesemer griesemer added this to the Backlog milestone Sep 9, 2021
@griesemer griesemer self-assigned this Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

1 participant