-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
Filing a bug, per suggestion on mailing list: https://groups.google.com/d/topic/golang-nuts/LwKSTzS72gg/discussion
What version of Go are you using (go version
)?
go version go1.8.3 darwin/amd64
Does this issue reproduce with the latest release?
Yes, I believe so. I can repro on the Go Playground, which is using Go 1.9.
What operating system and processor architecture are you using (go env
)?
Macbook Pro (darwin/amd64).
What did you do?
Type Identity
Created a type using reflect.ArrayOf
. Compared the resulting reflect.Type
instance to another type, an identical type, that was not acquired through the use of reflect.ArrayOf
.
Hashability
Created a type using reflect.ArrayOf
. Created a value of this type using reflect.New
. Attempted to use the array value as a key in a map.
https://play.golang.org/p/Qu0irn2rCF
What did you expect to see?
Type Identity
Per package documentation of the reflect package and language spec describing type identity (in particular, regarding array types), I expected the comparison result to be true.
Hashability
Per the language spec, allowing use of arrays as map keys, I expected using a value of a type created via reflect.ArrayOf
to be successfully used as a map key, without panic.
What did you see instead?
Type Identity
The comparison result was false.
Hashability
Attempting to use the constructed array value as a map key resulted in a panic:
runtime error: hash of unhashable type [8]int32