diff --git a/doc/go_spec.html b/doc/go_spec.html
index 6d7f90e98d..7b4bde0fe0 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
@@ -2684,18 +2684,17 @@ other interfaces based on their type sets. But this should get us going for now.
The predeclared
interface type comparable
denotes the set of all non-interface types that are
-comparable. Specifically,
+strictly comparable. Specifically,
a type T implements comparable if:
T is not an interface type and T supports the operations
- == and !=; or
+ T is not an interface type and T is strictly comparable; or
T is an interface type and each type in T's
- type set implements comparable.
+ type set is strictly comparable.
-int // implements comparable
+int // implements comparable (int is strictly comparable)
[]byte // does not implement comparable (slices cannot be compared)
interface{} // does not implement comparable (see above)
-interface{ ~int | ~string } // type parameter only: implements comparable
-interface{ comparable } // type parameter only: implements comparable
-interface{ ~int | ~[]byte } // type parameter only: does not implement comparable (not all types in the type set are comparable)
+interface{ ~int | ~string } // type parameter only: implements comparable (int, string types are stricly comparable)
+interface{ comparable } // type parameter only: implements comparable (comparable implements itself)
+interface{ ~int | ~[]byte } // type parameter only: does not implement comparable (slices are not comparable)
+interface{ ~struct{ any } } // type parameter only: does not implement comparable (field any is not strictly comparable)
@@ -5019,69 +5019,71 @@ to the type of the second operand, or vice versa.
The equality operators == and != apply
-to operands that are comparable.
+to operands of comparable types.
The ordering operators <, <=, >, and >=
-apply to operands that are ordered.
+apply to operands of ordered types.
These terms and the result of the comparisons are defined as follows:
true or both false.
u and v are
equal if both real(u) == real(v) and
imag(u) == imag(v).
nil.
Pointers to distinct zero-size variables may or may not be equal.
make
or if both have value nil.
nil.
x of non-interface type X and
- a value t of interface type T are comparable when values
- of type X are comparable and
+ a value t of interface type T can be compared
+ if type X is comparable and
X implements T.
They are equal if t's dynamic type is identical to X
and t's dynamic value is equal to x.
A comparison of two interface values with identical dynamic types -causes a run-time panic if values -of that type are not comparable. This behavior applies not only to direct interface +causes a run-time panic if that type +is not comparable. This behavior applies not only to direct interface value comparisons but also when comparing arrays of interface values or structs with interface-valued fields.
-Slice, map, and function values are not comparable.
+Slice, map, and function types are not comparable.
However, as a special case, a slice, map, or function value may
be compared to the predeclared identifier nil.
Comparison of pointer, channel, and interface values to nil
@@ -5126,6 +5132,30 @@ var (
)
+
+A type is strictly comparable if it is comparable and not an interface +type nor composed of interface types. +Specifically: +
+ +