diff options
author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-10-17 01:18:20 +0700 |
---|---|---|
committer | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2021-10-18 16:32:38 +0000 |
commit | 543a513304c35d42b162790a6e70191aac68225c (patch) | |
tree | 9db402d112302502271c0e826121691f736c8ec8 /src/reflect | |
parent | 42515418a99f2540427a5d32189f6d44fb06939e (diff) | |
download | go-543a513304c35d42b162790a6e70191aac68225c.tar.gz go-543a513304c35d42b162790a6e70191aac68225c.zip |
reflect: add test that method values have the same code pointers
Updates #40592
Change-Id: I16252dd57aceb5c49ddc11d8c12c601ca87ca902
Reviewed-on: https://go-review.googlesource.com/c/go/+/356252
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/all_test.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index 8642d60f8b..0370906f7d 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -2511,6 +2511,11 @@ func TestMethodValue(t *testing.T) { p := Point{3, 4} var i int64 + // Check that method value have the same underlying code pointers. + if p1, p2 := ValueOf(Point{1, 1}).Method(1), ValueOf(Point{2, 2}).Method(1); p1.Pointer() != p2.Pointer() { + t.Errorf("methodValueCall mismatched: %v - %v", p1, p2) + } + // Curried method of value. tfunc := TypeOf((func(int) int)(nil)) v := ValueOf(p).Method(1) |