]> Cypherpunks repositories - gostls13.git/commit
reflect: make StructOf panic for methods that don't work
authorIan Lance Taylor <iant@golang.org>
Wed, 28 Jun 2017 19:47:08 +0000 (12:47 -0700)
committerIan Lance Taylor <iant@golang.org>
Sat, 15 Jul 2017 00:47:41 +0000 (00:47 +0000)
commit87d5f6b9f65bc0f4a68d8712b500615df5df309c
treeddd8576d3c260959284c4318fb7096e7dba8e928
parent792f9c9a954c1fab92e5244f18072c4b2df4c301
reflect: make StructOf panic for methods that don't work

When StructOf is used with an anonymous field that has methods, and
that anonymous field is not the first field, the methods we generate
are incorrect because they do not offset to the field as required.
If we encounter that case, panic rather than doing the wrong thing.

Fixes #20824
Updates #15924

Change-Id: I3b0901ddbc6d58af5f7e84660b5e3085a431035d
Reviewed-on: https://go-review.googlesource.com/47035
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/reflect/all_test.go
src/reflect/type.go