reflect: make Value.Comparable return true for nil interface value

Fixes #65718

Change-Id: I0b3edf9085f2d71f915bdf8ff9d312509b438c5f
GitHub-Last-Rev: 9fb1ca1a63
GitHub-Pull-Request: golang/go#65750
Reviewed-on: https://go-review.googlesource.com/c/go/+/564795
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Jes Cok 2024-02-16 21:16:29 +00:00 committed by Gopher Robot
parent 1c9c9c8412
commit e41fabd688
2 changed files with 7 additions and 1 deletions

View file

@ -8027,6 +8027,7 @@ func TestValue_Comparable(t *testing.T) {
var a int
var s []int
var i interface{} = a
var iNil interface{}
var iSlice interface{} = s
var iArrayFalse interface{} = [2]interface{}{1, map[int]int{}}
var iArrayTrue interface{} = [2]interface{}{1, struct{ I interface{} }{1}}
@ -8035,6 +8036,11 @@ func TestValue_Comparable(t *testing.T) {
comparable bool
deref bool
}{
{
ValueOf(&iNil),
true,
true,
},
{
ValueOf(32),
true,