spec: fix prose in rule for keys of struct composite literals

Use "promoted" rather than "embedded" because the selector
provides access to a promoted field.

For #9859.

Change-Id: If62c5260ab7bdfef3d6ea4ff770543ad668ac9b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/755782
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Robert Griesemer
2026-03-16 15:30:40 -07:00
committed by Gopher Robot
parent f3966c1ada
commit c697e0fc48

View File

@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Language version go1.27 (March 5, 2026)",
"Subtitle": "Language version go1.27 (March 16, 2026)",
"Path": "/ref/spec"
}-->
@@ -3211,13 +3211,13 @@ For struct literals with keys the following rules apply:
<li>Every element must have a key.
</li>
<li>Each key must be a valid field <a href="#Selectors">selector</a>
[<a href="#Go_1.27">Go 1.27</a>] for a (possibly embedded) field
[<a href="#Go_1.27">Go 1.27</a>] for a (possibly promoted) field
of the struct; the key selects that field.
</li>
<li>The types of the embedded fields (if any) <a href="#Selectors">traversed</a>
to reach a selected field must not be pointer types.
</li>
<li>A key must not denote a field inside an embedded struct if
<li>A key must not denote a promoted field inside an embedded struct if
that struct is also specified by another key.
</li>
<li>The element list does not need to have an element for each struct field.