Commit a5026af5 authored by Marko Kungla's avatar Marko Kungla Committed by Ian Lance Taylor

reflect: enhance docs for IsZero and IsValid

Make it clear that IsValid checks that we have valid
reflect.Value and not the value of `v`

fixes #34152

Change-Id: Ib3d359eeb3a82bf733b9ed17c777fc4c143bc29c
Reviewed-on: https://go-review.googlesource.com/c/go/+/193841Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent b9704872
...@@ -305,7 +305,7 @@ func (v Value) IsNil() bool { ...@@ -305,7 +305,7 @@ func (v Value) IsNil() bool {
// IsValid reports whether v represents a value. // IsValid reports whether v represents a value.
// It returns false if v is the zero Value. // It returns false if v is the zero Value.
// If IsValid returns false, all other methods except String panic. // If IsValid returns false, all other methods except String panic.
// Most functions and methods never return an invalid value. // Most functions and methods never return an invalid Value.
// If one does, its documentation states the conditions explicitly. // If one does, its documentation states the conditions explicitly.
func (v Value) IsValid() bool { func (v Value) IsValid() bool {
return v.flag != 0 return v.flag != 0
......
...@@ -1076,7 +1076,7 @@ func (v Value) IsNil() bool { ...@@ -1076,7 +1076,7 @@ func (v Value) IsNil() bool {
// IsValid reports whether v represents a value. // IsValid reports whether v represents a value.
// It returns false if v is the zero Value. // It returns false if v is the zero Value.
// If IsValid returns false, all other methods except String panic. // If IsValid returns false, all other methods except String panic.
// Most functions and methods never return an invalid value. // Most functions and methods never return an invalid Value.
// If one does, its documentation states the conditions explicitly. // If one does, its documentation states the conditions explicitly.
func (v Value) IsValid() bool { func (v Value) IsValid() bool {
return v.flag != 0 return v.flag != 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment