go/src/reflect
hopehook 7ffc1e47b4 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>
2022-10-17 14:53:58 +00:00
..
internal
abi.go cmd/compile,runtime,reflect: move embedded bit from offset to name 2022-06-14 23:22:11 +00:00
abi_test.go all: separate doc comment from //go: directives 2022-04-05 17:54:15 +00:00
all_test.go reflect: panic when Value.Equal using two non-comparable values 2022-10-17 14:53:58 +00:00
arena.go arena: add experimental arena package 2022-10-12 20:23:36 +00:00
asm_386.s
asm_amd64.s
asm_arm.s
asm_arm64.s all: delete ARM64 non-register ABI fallback path 2022-03-18 18:26:13 +00:00
asm_loong64.s go, math, os, reflect: support standard library for loong64 2022-05-20 15:12:52 +00:00
asm_mips64x.s all: remove more leftover // +build lines 2021-11-06 10:24:44 +00:00
asm_mipsx.s all: remove more leftover // +build lines 2021-11-06 10:24:44 +00:00
asm_ppc64x.s all: remove more leftover // +build lines 2021-11-06 10:24:44 +00:00
asm_riscv64.s reflect, runtime: add reflect support for regabi on riscv64 2022-04-01 01:41:42 +00:00
asm_s390x.s
asm_wasm.s
benchmark_test.go reflect: move benchmarks to its own file 2022-09-13 17:41:16 +00:00
deepequal.go reflect: use cgo.Incomplete instead of go:notinheap in tests 2022-08-31 01:16:54 +00:00
example_test.go reflect: add example for FieldByName 2022-05-19 20:04:36 +00:00
export_test.go cmd/compile,runtime,reflect: move embedded bit from offset to name 2022-06-14 23:22:11 +00:00
float32reg_generic.go reflect: implement float32 for regabi riscv64 2022-05-04 13:38:32 +00:00
float32reg_ppc64x.s all: remove more leftover // +build lines 2021-11-06 10:24:44 +00:00
float32reg_riscv64.s reflect: implement float32 for regabi riscv64 2022-05-04 13:38:32 +00:00
makefunc.go all: gofmt main repo 2022-04-11 16:34:30 +00:00
nih_test.go reflect: use cgo.Incomplete instead of go:notinheap in tests 2022-08-31 01:16:54 +00:00
set_test.go reflect: use strings.Builder 2022-09-07 13:56:11 +00:00
stubs_ppc64x.go all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor) 2021-10-28 18:17:57 +00:00
stubs_riscv64.go reflect: implement float32 for regabi riscv64 2022-05-04 13:38:32 +00:00
swapper.go all: gofmt -w -r 'interface{} -> any' src 2021-12-13 18:45:54 +00:00
tostring_test.go all: use reflect.{Pointer,PointerTo} 2021-10-26 14:24:17 +00:00
type.go reflect: avoid unnecessary copy of funcTypes 2022-10-04 23:15:54 +00:00
value.go reflect: panic when Value.Equal using two non-comparable values 2022-10-17 14:53:58 +00:00
visiblefields.go all: use reflect.{Pointer,PointerTo} 2021-10-26 14:24:17 +00:00
visiblefields_test.go all: consistently use US spelling of present participles 2022-04-08 13:44:41 +00:00