From: Robert Griesemer Date: Wed, 13 Jun 2012 20:24:41 +0000 (-0400) Subject: [release-branch.go1] go spec: clarify promotion rules for methods/fields of anonymous... X-Git-Tag: go1.0.2~28 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9f0345c4ecca556643765d89edcc787a0fa87005;p=gostls13.git [release-branch.go1] go spec: clarify promotion rules for methods/fields of anonymous fields ««« backport ae0301294b9b go spec: clarify promotion rules for methods/fields of anonymous fields Fixes #3635. R=rsc, r, iant, kevlar, iant CC=golang-dev https://golang.org/cl/6217045 »»» --- diff --git a/doc/go_spec.html b/doc/go_spec.html index 78197351f2..90acc1704e 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -684,6 +684,8 @@ consists of all methods with receiver type T. The method set of the corresponding pointer type *T is the set of all methods with receiver *T or T (that is, it also contains the method set of T). +Further rules apply to structs containing anonymous fields, as described +in the section on struct types. Any other type has an empty method set. In a method set, each method must have a unique method name. @@ -955,28 +957,39 @@ struct {

-Fields and methods (§Method declarations) of an anonymous field are -promoted to be ordinary fields and methods of the struct (§Selectors). -The following rules apply for a struct type S and -a type named T: +A field or method f of an +anonymous field in a struct x is called promoted if +x.f is a legal selector that denotes +that field or method f.

-