Commit be23e98e authored by Matthew Dempsky's avatar Matthew Dempsky

reflect: cleanup wording for type identity/equality

Use terms like "equal" and "identical types" to match the Go spec,
rather than inventing a new explanation. See also discussion on
golang.org/cl/27170.

Updates #16348.

Change-Id: I0fe0bd01c0d1da3c8937a579c2ba44cf1eb16b71
Reviewed-on: https://go-review.googlesource.com/28054Reviewed-by: 's avatarRob Pike <r@golang.org>
parent 55875977
...@@ -30,11 +30,8 @@ import ( ...@@ -30,11 +30,8 @@ import (
// calling kind-specific methods. Calling a method // calling kind-specific methods. Calling a method
// inappropriate to the kind of type causes a run-time panic. // inappropriate to the kind of type causes a run-time panic.
// //
// You can use == with reflect.Type values to check whether two types // Type values are comparable, such as with the == operator.
// are the same. If T1 and T2 are Go types, and v1 and v2 are values of // Two Type values are equal if they represent identical types.
// those types respectively, then reflect.TypeOf(v1) == reflect.TypeOf(v2)
// if and only if both (interface{})(v2).(T1) and (interface{})(v1).(T2)
// succeed.
type Type interface { type Type interface {
// Methods applicable to all types. // Methods applicable to all types.
...@@ -86,7 +83,7 @@ type Type interface { ...@@ -86,7 +83,7 @@ type Type interface {
// String returns a string representation of the type. // String returns a string representation of the type.
// The string representation may use shortened package names // The string representation may use shortened package names
// (e.g., base64 instead of "encoding/base64") and is not // (e.g., base64 instead of "encoding/base64") and is not
// guaranteed to be unique among types. To test for equality, // guaranteed to be unique among types. To test for type identity,
// compare the Types directly. // compare the Types directly.
String() string String() string
......
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