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

mdempsky opened this issue Jan 25, 2016 · 1 comment

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

mdempsky opened this issue Jan 25, 2016 · 1 comment


Copy link

@mdempsky mdempsky commented Jan 25, 2016

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 added this to the Go1.8 milestone May 18, 2016
@rsc rsc removed this from the Go1.7 milestone May 18, 2016
Copy link

@gopherbot gopherbot commented Aug 18, 2016

CL mentions this issue.


@gopherbot gopherbot closed this in 021f243 Aug 18, 2016
@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.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants