You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.TypeOfdoes return the expected type when applied to the entire composite literal expression (i.e., [...]int{0}).
http://play.golang.org/p/eksKQzD3Km
In a composite literal expression like
[1]int{0}
, you can useinfo.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 getnil
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
The text was updated successfully, but these errors were encountered: