design: type parameters: clarify depth of embedded type constraint methods For golang/go#43621 Change-Id: Ice63bffb753a1c429ee3537cb3093f2903d499d6 Reviewed-on: https://go-review.googlesource.com/c/proposal/+/283113 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
diff --git a/design/go2draft-type-parameters.md b/design/go2draft-type-parameters.md index 297b6c2..c75eb75 100644 --- a/design/go2draft-type-parameters.md +++ b/design/go2draft-type-parameters.md
@@ -2,7 +2,7 @@ Ian Lance Taylor\ Robert Griesemer\ -November 25, 2020 +January 11, 2021 ## Abstract @@ -3832,6 +3832,11 @@ When a generic type is a struct, and the type parameter is embedded as a field in the struct, any methods of the type parameter's constraint are promoted to be methods of the struct. +(For purposes of [selector +resolution](https://golang.org/ref/spec#Selectors), these methods are +treated as being at depth 0 of the type parameter, even if in the +actual type argument the methods were themselves promoted from an +embedded type.) ``` // NamedInt is an int with a name. The name can be any type with