reflect: canonicalize types returned by StructOf() and friends
commit7057e01ef3ca354abd3ac17af3c3890906eb127c
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Jun 2018 20:23:40 +0000 (5 20:23 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Jun 2018 20:23:40 +0000 (5 20:23 +0000)
tree20115a17b149bdd5fa407deec538f86505eadb6d
parent7d5774e7fb9a0179c3a63491f670f6326d8ac8c3
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

    Reviewed-on: https://go-review.googlesource.com/115577

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261216 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
libgo/go/reflect/all_test.go
libgo/go/reflect/type.go