Skip to content

Commit 543a513

Browse files
committed
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 <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 4251541 commit 543a513

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/reflect/all_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -2511,6 +2511,11 @@ func TestMethodValue(t *testing.T) {
25112511
p := Point{3, 4}
25122512
var i int64
25132513

2514+
// Check that method value have the same underlying code pointers.
2515+
if p1, p2 := ValueOf(Point{1, 1}).Method(1), ValueOf(Point{2, 2}).Method(1); p1.Pointer() != p2.Pointer() {
2516+
t.Errorf("methodValueCall mismatched: %v - %v", p1, p2)
2517+
}
2518+
25142519
// Curried method of value.
25152520
tfunc := TypeOf((func(int) int)(nil))
25162521
v := ValueOf(p).Method(1)

0 commit comments

Comments
 (0)