]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: handle calling a method on a type param in stenciling
authorDan Scales <danscales@google.com>
Mon, 8 Feb 2021 22:33:51 +0000 (14:33 -0800)
committerDan Scales <danscales@google.com>
Wed, 10 Feb 2021 01:44:48 +0000 (01:44 +0000)
commit12e15d430d408ff9a961bdfb72cfc7f0b521a354
treefe0963bbd6e9d454d65d7c1ac6e611dd5e59947f
parentca18c4205442dc49eb35272b9f4b7f0cd8f2c079
[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>
src/cmd/compile/internal/noder/expr.go
src/cmd/compile/internal/noder/helpers.go
src/cmd/compile/internal/noder/stencil.go
src/cmd/compile/internal/types/type.go
test/typeparam/map.go [new file with mode: 0644]
test/typeparam/stringer.go [new file with mode: 0644]