-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: named types defined within a function print as if defined at package scope #5501
Comments
Here's a concrete suggestion: the local type should have name that is not a valid Go identifier, e.g. main.T$1, where 1 is a sequence number for fresh identifiers. For the record: gc and go/types behave the same: % cat ~/5501.go package main import "fmt" type T int var outer T func main() { type T int var inner T fmt.Printf("%T %T\n", outer, inner) } % go run ~/5501.go main.T main.T % ./ssadump -run ~/5501.go main.T main.T |
This shouldn't be too hard to address. Try for 1.9. |
Better suggestion than #5501 (comment): Print a type together with position information; that will remove any ambiguity. This can be optimized such that the position information is only present if there two types with the same name in the same package. Shouldn't be too hard to do but may affect tests that rely on a specific output format. Thus moving to Go1.10. |
The text was updated successfully, but these errors were encountered: