From 9f0345c4ecca556643765d89edcc787a0fa87005 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 13 Jun 2012 16:24:41 -0400 Subject: [PATCH] [release-branch.go1] go spec: clarify promotion rules for methods/fields of anonymous fields MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ««« 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 »»» --- doc/go_spec.html | 49 ++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) 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.

-