]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: allow generic funcs to call other generic funcs for...
authorDan Scales <danscales@google.com>
Mon, 8 Feb 2021 18:23:05 +0000 (10:23 -0800)
committerDan Scales <danscales@google.com>
Mon, 8 Feb 2021 19:32:55 +0000 (19:32 +0000)
commit0fbde54ea646aa1363fc172610a75e5ba877d4ec
tree8248de98dd720fae5b722f6b3f5d0b8b52d7dd71
parentdcb5e0392e73c900db0f7260b392c91611e33540
[dev.typeparams] cmd/compile: allow generic funcs to call other generic funcs for stenciling

 - Handle generic function calling itself or another generic function in
   stenciling. This is easy - after it is created, just scan an
   instantiated generic function for function instantiations (that may
   needed to be stenciled), just like non-generic functions. The types
   in the function instantiation will already have been set by the
   stenciling.

 - Handle OTYPE nodes in subster.node() (allows for generic type
   conversions).

 - Eliminated some duplicated work in subster.typ().

 - Added new test case fact.go that tests a generic function calling
   itself, and simple generic type conversions.

 - Cause an error if a generic function is to be exported (which we
   don't handle yet).

 - Fixed some suggested changes in the add.go test case that I missed in
   the last review.

Change-Id: I5d61704254c27962f358d5a3d2e0c62a5099f148
Reviewed-on: https://go-review.googlesource.com/c/go/+/290469
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/noder/object.go
src/cmd/compile/internal/noder/stencil.go
test/typeparam/fact.go [new file with mode: 0644]
test/typeparam/sum.go [moved from test/typeparam/add.go with 61% similarity]