reflect: canonicalize types returned by StructOf() and friends

Background: since gccgo does not currently merge identical types at link time,
the reflect function canonicalize() exists to choose a canonical specimen
for each set of identical types.
In this way, user code has the guarantee that identical types
will always compare as ==

Change: arrange reflect functions MapOf(), SliceOf(), StructOf() etc.
to call canonicalize() on the types they create, before storing the types
in internal lookup caches and returning them.

This fixes known cases where canonicalize() is needed but was missing.
Supersedes https://golang.org/cl/112575 and mostly fixes issue 25284.

Updates golang/go#25284

Change-Id: I5a71bf5ff4bbb2585a5b84072cb59af9e9d16518
Reviewed-on: https://go-review.googlesource.com/115577
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 files changed