specより引用 A field or method f of an embedded field in a struct x is called promoted if x.f is a legal selector that denotes that field or method f. 構造体内の埋め込まれたフィールド x のフィールドまたはメソッド f は、x.f が f を表すlegalな selectorである場合に promotedと呼ぶ。
selectorの定義 specより引用 For a value x of type T or *T where T is not a pointer or interface type, x.f denotes the field or method at the shallowest depth in T where there is such an f. If there is not exactly one f with shallowest depth, the selector expression is illegal. 型 T または *T の値 x について(ここで T はポインタ型でもインターフェース型でもない)、 x.f は T において f という名前のフィールドまたはメソッドが存在する 最も浅い深さ のものを指す。最も 浅い深さに f が一つだけ存在しない場合、この selectorはillegalである。 つまり…
Go にも書いてあった Embedding types introduces the problem of name conflicts but the rules to resolve them are simple. First, a field or method X hides any other item X in a more deeply nested part of the type. 埋め込み型は名前衝突の問題を引き起こすが、これを解決するルールは単純である。まず、 フィールドまたはメソッド X は、型内のより深くネストされた部分にある他の項目 X を隠す。
Go にも書いてあった Second, if the same name appears at the same nesting level, it is usually an error; (中 略)However, if the duplicate name is never mentioned in the program outside the type definition, it is OK. (中略) there is no problem if a field is added that conflicts with another field in another subtype if neither field is ever used. 第二に、同じネストレベルで同じ名前が現れる場合、通常はエラーとなる。(中略)ただし、重複す る名前が型定義の外でプログラム内で一切言及されない場合は問題ない。(中略)別のサブタイ プ内のフィールドと競合するフィールドが追加されても、いずれのフィールドも使用されない限り問 題はない。