diff options
| author | Ian Lance Taylor <iant@golang.org> | 2021-01-11 12:42:46 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2021-01-12 06:03:13 +0000 |
| commit | fe14d6e3319eb32e22d3f6f02a89f72fd6f31aa9 (patch) | |
| tree | e2c9c5d726a546b9e2b416b4b46ec2dcdf4120c0 | |
| parent | 061d70b850701c28388b51f2dd5d85b151a74339 (diff) | |
| download | go-x-proposal-fe14d6e3319eb32e22d3f6f02a89f72fd6f31aa9.tar.xz | |
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>
| -rw-r--r-- | design/go2draft-type-parameters.md | 7 |
1 files changed, 6 insertions, 1 deletions
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 @@ func (l *Lockable[T]) Set(v T) { 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 |
