From badbc52d82b1f97861bf30457014fc9ea19dfcb2 Mon Sep 17 00:00:00 2001
From: Robert Griesemer
+[For reviewers: Sections where we know of missing prose are marked like this. The markers will be removed before the release.] +
+@@ -1498,15 +1503,9 @@ type Floatish struct { } - -
-An interface type T
may not embed itself
-or any interface type that embeds T
, recursively.
+An interface type T
may not embed any type element
+that is, contains, or embeds T
, recursively.
@@ -1522,6 +1521,11 @@ type Bad1 interface { type Bad2 interface { Bad1 } + +// illegal: Bad3 cannot embed a union containing Bad3 +type Bad3 interface { + ~int | ~string | Bad3 +}
+[The definition of specific types is not quite correct yet.] +
+An interface specification that contains type elements defines a (possibly empty) set of specific types. @@ -3346,7 +3354,9 @@ f.p[i].x()
+[This section is missing rules for x.f where x's type is a type parameter and f is a field.] +
For a primary expression x
@@ -4557,14 +4567,6 @@ ensures that type inference does not depend on the order of the untyped argument
Constraint type inference infers type arguments by considering type constraints.
If a type parameter P
has a constraint with a
@@ -4604,6 +4606,17 @@ Thus, in this example, constraint type inference can infer the second type argum
first one.
+Using the core type of a constraint may lose some information: In the (unlikely) case that
+the constraint's type set contains a single defined type
+N
, the corresponding core type is N
's underlying type rather than
+N
itself. In this case, constraint type inference may succeed but instantiation
+will fail because the inferred type is not in the type set of the constraint.
+Thus, constraint type inference uses the adjusted core type of
+a constraint: if the type set contains a single type, use that type; otherwise use the
+constraint's core type.
+
Generally, constraint type inference proceeds in two phases: Starting with a given substitution map M @@ -4611,7 +4624,7 @@ substitution map M
-Additionally, if T
or x's
type V
are type
+Additionally, if T
or x
's type V
are type
parameters with specific types, x
can also be converted to type T
if one of the following conditions applies:
delete
is a no-op.
+[We don't support generic arguments for these built-ins for Go 1.18.] +
Three functions assemble and disassemble complex numbers.