From 4703546a294b28e4e23043fe9cb745f27e55edab Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 13 Jun 2022 10:18:38 -0700 Subject: [PATCH] spec: add missing optional type arguments after TypeName in syntax Types may be generic, so each occurrence of a TypeName may be followed by optional type arguments. Add the missing syntactic (EBNF) factor. The syntax of type names followed by type arguments matches the syntax of operand names followed by type arguments (operands may also be types, or generic functions, among other things). This opens the door to factoring out this shared syntax, but it will also require some adjustments to prose to make it work well. Leaving for another change. Fixes #53240. Change-Id: I15212225c28b27f7621e3ca80dfbd131f6b7eada Reviewed-on: https://go-review.googlesource.com/c/go/+/411918 Reviewed-by: Ian Lance Taylor Reviewed-by: Robert Griesemer --- doc/go_spec.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index 37580a83b7..170c359c87 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -1025,7 +1025,7 @@ be unique.
 StructType    = "struct" "{" { FieldDecl ";" } "}" .
 FieldDecl     = (IdentifierList Type | EmbeddedField) [ Tag ] .
-EmbeddedField = [ "*" ] TypeName .
+EmbeddedField = [ "*" ] TypeName [ TypeArgs ] .
 Tag           = string_lit .
 
@@ -3029,7 +3029,7 @@ Each element may optionally be preceded by a corresponding key.
 CompositeLit  = LiteralType LiteralValue .
 LiteralType   = StructType | ArrayType | "[" "..." "]" ElementType |
-                SliceType | MapType | TypeName .
+                SliceType | MapType | TypeName [ TypeArgs ] .
 LiteralValue  = "{" [ ElementList [ "," ] ] "}" .
 ElementList   = KeyedElement { "," KeyedElement } .
 KeyedElement  = [ Key ":" ] Element .
-- 
2.48.1