aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/subst.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-08-23 18:29:38 -0700
committerRobert Griesemer <gri@golang.org>2021-08-24 16:36:48 +0000
commit1ff0554b5318d5a39e2b26a9c84330e6aa47b1c6 (patch)
tree14a98ed5b571cdf8bcdf847077e7ee04b9869de2 /src/cmd/compile/internal/types2/subst.go
parentbd9776357732eb3a3c635427bb3591e4cbc79cc5 (diff)
downloadgo-1ff0554b5318d5a39e2b26a9c84330e6aa47b1c6.tar.gz
go-1ff0554b5318d5a39e2b26a9c84330e6aa47b1c6.zip
cmd/compile/internal/types2: use []*TypeParam rather than []*TypeName for type param lists
This is a port of CL 343932 from go/types, with the necessary adjustments to the compiler. This change improves type safety slightly, avoids many internal type assertions, and simplifies some code paths. Change-Id: Ie9c4734814f49cd248927152d7b3264d3578428c Reviewed-on: https://go-review.googlesource.com/c/go/+/344614 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/subst.go')
-rw-r--r--src/cmd/compile/internal/types2/subst.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types2/subst.go b/src/cmd/compile/internal/types2/subst.go
index edbbdb4758..467066cc69 100644
--- a/src/cmd/compile/internal/types2/subst.go
+++ b/src/cmd/compile/internal/types2/subst.go
@@ -15,11 +15,11 @@ type substMap map[*TypeParam]Type
// makeSubstMap creates a new substitution map mapping tpars[i] to targs[i].
// If targs[i] is nil, tpars[i] is not substituted.
-func makeSubstMap(tpars []*TypeName, targs []Type) substMap {
+func makeSubstMap(tpars []*TypeParam, targs []Type) substMap {
assert(len(tpars) == len(targs))
proj := make(substMap, len(tpars))
for i, tpar := range tpars {
- proj[tpar.typ.(*TypeParam)] = targs[i]
+ proj[tpar] = targs[i]
}
return proj
}