From bd42aa86d32f1c29859151520647175e07f3fbca Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 13 Dec 2022 13:59:12 -0800 Subject: [PATCH] spec: describe new semantics for comparable and constraint satisfaction For #56548. Fixes #57012. Change-Id: I44f850522e52b1811025fb31bcef289da8f8089d Reviewed-on: https://go-review.googlesource.com/c/go/+/457437 TryBot-Bypass: Robert Griesemer Reviewed-by: Ian Lance Taylor Reviewed-by: Robert Findley Reviewed-by: Robert Griesemer --- doc/go_spec.html | 80 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 57 insertions(+), 23 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index 7b4bde0fe01..2cf53c8a979 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -2652,7 +2652,7 @@ using type parameters in a type parameter list.

Type constraints

-A type constraint is an interface that defines the +A type constraint is an interface that defines the set of permissible type arguments for the respective type parameter and controls the operations supported by values of that type parameter.

@@ -2663,7 +2663,7 @@ TypeConstraint = TypeElem .

If the constraint is an interface literal of the form interface{E} where -E is an embedded type element (not a method), in a type parameter list +E is an embedded type element (not a method), in a type parameter list the enclosing interface{ … } may be omitted for convenience:

@@ -2671,7 +2671,7 @@ the enclosing interface{ … } may be omitted for convenience: [T []P] // = [T interface{[]P}] [T ~int] // = [T interface{~int}] [T int|string] // = [T interface{int|string}] -type Constraint ~int // illegal: ~int is not inside a type parameter list +type Constraint ~int // illegal: ~int is not in a type parameter list