aboutsummaryrefslogtreecommitdiff
path: root/test/typeparam/map.go
AgeCommit message (Collapse)Author
2021-02-11[dev.typeparams] cmd/compile: small fixes for stencilingDan Scales
- Create the stencil name using targ.Type.String(), which handles cases where, for example, a type argument is a pointer to a named type, etc. *obj. - Set name.Def properly for a new stenciled func (have the symbol point back to the associated function node). Will be required when exporting. - Add missing copying of Func field when making copies of Name nodes. (On purpose (it seems), Name nodes don't have a copy() function, so we have to copy all the needed fields explicitly.) - Deal with nil type in subster.node(), which is the type of the return value for a function that doesn't return anything. - Fix min to match standard want/go form, and add in float tests. Changed Got -> got in bunch of other typeparam tests. - Add new tests index.go, settable.go, and smallest.go (similar to examples in the type param proposal), some of which need the above changes. Change-Id: I09a72302bc1fd3635a326da92405222afa222e85 Reviewed-on: https://go-review.googlesource.com/c/go/+/291109 Trust: Dan Scales <danscales@google.com> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2021-02-10[dev.typeparams] cmd/compile: handle calling a method on a type param in ↵Dan Scales
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>