diff options
| author | hopehook <hopehook.com@gmail.com> | 2022-10-07 22:42:15 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-10-17 14:53:58 +0000 |
| commit | 7ffc1e47b4e3b163f06fc33c9adbc29cb1622d47 (patch) | |
| tree | a12106d1c0daf4b24fedb21a161a2c1f7b8d3401 /src/runtime | |
| parent | 9abcc487f8b04db8fd46eaa429a7eef5a5228241 (diff) | |
| download | go-7ffc1e47b4e3b163f06fc33c9adbc29cb1622d47.tar.xz | |
reflect: panic when Value.Equal using two non-comparable values
Assuming the two values are valid and non-comparable, Equal should panic.
x := reflect.ValueOf([]int{1, 2, 3})
x.Equal(x) // can not report false, should panic
Assuming one of them is non-comparable and the other is invalid, it should
always report false.
x := reflect.ValueOf([]int{1, 2, 3})
y := reflect.ValueOf(nil)
x.Equal(y) // should report false
For #46746.
Change-Id: Ifecd77ca0b3de3019fae2be39048f9277831676c
Reviewed-on: https://go-review.googlesource.com/c/go/+/440037
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime')
0 files changed, 0 insertions, 0 deletions
