diff options
author | Dan Scales <danscales@google.com> | 2021-02-08 14:33:51 -0800 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-02-10 01:44:48 +0000 |
commit | 12e15d430d408ff9a961bdfb72cfc7f0b521a354 (patch) | |
tree | fe0963bbd6e9d454d65d7c1ac6e611dd5e59947f /src/cmd/compile/internal/types/type.go | |
parent | ca18c4205442dc49eb35272b9f4b7f0cd8f2c079 (diff) | |
download | go-12e15d430d408ff9a961bdfb72cfc7f0b521a354.tar.gz go-12e15d430d408ff9a961bdfb72cfc7f0b521a354.zip |
[dev.typeparams] cmd/compile: handle calling a method on a type param in stenciling
- Have to delay the extra transformation on methods invoked on a type
param, since the actual transformation (including path through
embedded fields) will depend on the instantiated type. I am currently
doing the transformation during the stencil substitution phase. We
probably should have a separate pass after noder2 and stenciling,
which drives the extra transformations that were in the old
typechecker.
- We handle method values (that are not called) and method calls. We
don't currently handle method expressions.
- Handle type substitution in function types, which is needed for
function args in generic functions.
- Added stringer.go and map.go tests, testing the above changes
(including constraints with embedded interfaces).
Change-Id: I3831a937d2b8814150f75bebf9f23ab10b93fa00
Reviewed-on: https://go-review.googlesource.com/c/go/+/290550
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/types/type.go')
-rw-r--r-- | src/cmd/compile/internal/types/type.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go index 8d07b88ecd..987aa11454 100644 --- a/src/cmd/compile/internal/types/type.go +++ b/src/cmd/compile/internal/types/type.go @@ -1657,6 +1657,7 @@ func NewInterface(pkg *Pkg, methods []*Field) *Type { // not really be needed except for the type checker). func NewTypeParam(pkg *Pkg, constraint *Type) *Type { t := New(TTYPEPARAM) + constraint.wantEtype(TINTER) t.methods = constraint.methods t.Extra.(*Interface).pkg = pkg return t |