1
0
mirror of https://github.com/golang/go synced 2024-09-29 20:14:29 -06:00
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_test.go
abi.go
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_arm64.s
asm_arm.s
asm_loong64.s
asm_mips64x.s
asm_mipsx.s
asm_ppc64x.s
asm_riscv64.s
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
export_test.go
float32reg_generic.go
float32reg_ppc64x.s
float32reg_riscv64.s
makefunc.go
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
stubs_riscv64.go
swapper.go
tostring_test.go
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_test.go
visiblefields.go