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: cannot find type of [...]T type literals #14092

Closed
mdempsky opened this issue Jan 25, 2016 · 1 comment
Closed

go/types: cannot find type of [...]T type literals #14092

mdempsky opened this issue Jan 25, 2016 · 1 comment
Milestone

Comments

@mdempsky
Copy link
Member

http://play.golang.org/p/eksKQzD3Km

In a composite literal expression like [1]int{0}, you can use info.TypeOf on the [1]int type literal subexpression to get the type [1]int.

However, if you use info.TypeOf on the [...]int subexpression of [...]int{0}, you get nil instead. I would expect that go/types should report that this [...]int means the type [1]int.

As a workaround, info.TypeOf does return the expected type when applied to the entire composite literal expression (i.e., [...]int{0}).

/cc @griesemer @alandonovan

@mdempsky mdempsky added this to the Go1.7 milestone Jan 25, 2016
@griesemer griesemer self-assigned this Jan 25, 2016
@rsc rsc modified the milestones: Go1.8, Go1.7 May 18, 2016
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/27316 mentions this issue.

@golang golang locked and limited conversation to collaborators Aug 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants